Functional Programming - Implement the filter Method on a Prototype

hi can someone show me how to change

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

  for(let i=0;i<this.length;i++){
if(Boolean(callback(this[i],i,this)) === true){
newArray.push(this[i]);
}

  }
  
  // Only change code below this line
return newArray;
  
};

to use a forEach instead?

i keep getting unexpected token errors;

Please also post the code with the errors.

here it is, i cannot find the appropriate way to use the foreach

Array.prototype.myFilter = function(callback) {
  const newArray = [];
  // Only change code below this line
this.forEach((element in this) => {
  if(Boolean(callback(this[i],i,this))){
    newArray.push(this[i]);
  }
})
  // Only change code above this line
  return newArray;
};

Since you are referencing i later, how do you make the index of the element available in the forEach method? If you are not sure, then take a look at the documentation.