Thank you, now I think that I understand better. So, is this editing of my p.2 (below) correct?
- the keyword
this
is here, because it refers to the array, which the forEach() method should be called on. In our case,this
is[23, 65, 98, 5]
ins.myMap(function(item){return item*2})
;
My question was about recommended Solution 1 from here freeCodeCamp Challenge Guide: Implement map on a Prototype, not about my own solution.
My code works properly, this is the same approach like in Solution 1. Here it is:
// Add your code below this line
this.forEach(element => newArray.push(callback(element)));
// Add your code above this line