Jan 21, 2021
Is it necessary to use `.call` for filter and reduce. Can I just normally call the predicate with the array element ? like
Array.prototype.myfilter = function (func) {
let arr = this;
let newArr = [];
for (let i = 0; i < arr.length; i++) {
if (func(arr[i])) {
newArr.push(arr[i]);
}
}
return newArr;
};