I have no idea what the problem is here. I know I’m still in the beginner stages of things but geesh, thought I’d be making some progress by now.
Any help is much appreciated!
Array.prototype.myMap = function(callback) {
const newArray = [];
// Only change code below this line
this.forEach(item => newArray.push(callback(item)));
// Only change code above this line
return newArray;
};
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.1 Safari/605.1.15
Challenge: Functional Programming - Implement map on a Prototype
Take also a closer look at the test case itself. Previous ones are passing because callback function is having just a single parameter. However map method can take callback with more parameters.