Using only "this[i]" in the callback function doesn't work except adding "s[i]" to it

// The global variable
var s = [23, 65, 98, 5];

Array.prototype.myMap = function(callback) {
var newArray = [];
// Only change code below this line
  for(let i = 0; i < this.length; i++){
       newArray.push([i],  s[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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36

Challenge: Implement map on a Prototype

Link to the challenge:

Instead of deleting the Tell us what’s happening section, please actually fill it out. What do you want help with, exactly?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.