79306900

Date: 2024-12-25 05:04:52
Score: 1
Natty:
Report link

this is what i came up with:

Array.prototype.myFilter = function(callback) {
const finalArray = []

for(let i = 0; i<this.length; i++) {
  const res = callback(this[i],i,this)
  if(res) finalArray.push(this[i])
  }

  return finalArray
}

const res = [1,2,3,4,5,6].myFilter((val) => val % 2 === 0)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: mohammad khakshoor