Filter Method on a Prototype challenge

Hi guys why are my not passing this challenge???
Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

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

Array.prototype.myFilter = function(callback) {
// Only change code below this line
const newArray = [];
for (let i = 0; i < this.length; i++) {
   if ((this[i])) {
  newArray.push(this[i]);
}
}
// Only change code above this line
return newArray;
};

const new_s = s.myFilter(function(item) {
return item % 2 === 1;
});

  **Your browser information:**

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

Challenge: Implement the filter Method on a Prototype

Link to the challenge:

You aren’t using the callback function.

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