Tell us what’s happening:
I don’t understand what the required of this challenge. I changed the code many times and read the text of challenge but I got stuck!!!
My code so far
// The global variable
var s = [23, 65, 98, 5];
Array.prototype.myMap = function(callback) {
var newArray = [];
// Only change code below this line
var newArray = [];
for (let i = 0; i < newArray.length; i++) {
}
// Only change 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 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0
.
Challenge: Implement map on a Prototype
Link to the challenge: