Functional Programming - Implement the filter Method on a Prototype

Tell us what’s happening:
I’ve figured out that i probably will need a for loop for this with .this, but how to proceed?

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/107.0

Challenge: Functional Programming - Implement the filter Method on a Prototype

Link to the challenge:

try describing what this method is supposed to do
for eg., If I have never heard of filter before, how would you describe your method to me (what are the parameters, what is the return and how does it behave?)

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