I really did not understand

Tell us what’s happening:
Can someone help me, I really didn’t understand how to do that.

Your 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
// 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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Implement map on a Prototype

Link to the challenge:

callback is a function, and you can reference the array on which the method is used with this

do you understand what the map method does?

Yeah im quite understand, i already read about that a lot. But didnt fully understand because my english isnt too good as well.

try explaining what you understand of what the map method does

So after read in MDN i understand like this:
Map method have parameter, the paramenter iterate every item inside array then send it into new array, without changes the original one.

Am i missing something valuable? or i wrong?

map takes an array, and returns a new array where each element is changed using the passed in function

you need to make the same
in the method you are writing, the function is called callback and the array this, you need to return a new array with all elements changed using the function

1 Like

Okay, i will experiment first, thank you cap.

Damn, after console.log(this) i know what should i do.

Thank you again cap, i completed this lesson :smile: