Implement-map-on-a-prototype

Implement-map-on-a-prototype
0.0 0

#1

Tell us what’s happening:

Your code so far



// the global Array
var s = [23, 65, 98, 5];

Array.prototype.myMap = function(callback){
  var newArray = [];
  // Add your code below this line
  
  // Add your code above this line
  return newArray;

};

var new_s = s.myMap(function(item){
  return item * 2;
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:


#2

You did not ask a question, so we do not know how to help you at this point.


#3

this is a tough one for folks not familiar with map, like me! How do a parse the callback argument or variable to create a loop with it? Is it an object, or an array or arguments?