Implement map on a Prototype-weird

I’ve got a weird output! :open_mouth: what is wrong I am confused.

output => 0,2,4,6

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

Array.prototype.myMap = function(callback){
  var newArray = [];
  // Add your code below this line
 
  for (let i = 0; i < this.length; i++) {
    newArray.push(callback(i))
  }
  // Add your code above this line
  return newArray;

};

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype

You are passing the index i to the callback. I think you mean this[i] instead.

thanks i’ve already got it by adding one more this kw