JavaScript Problem


Write a function called map which accepts two parameters: an array and a callback. The map function should return a new array with the result of each value being passed to the callback function. Here’s an example:

map([1,2,3,4], function(val){
    return val * 2;
}); // [2,4,6,8]


maps needs to be called on an array, see the docs:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.