So I was implementing a polyfill for some standards ES6+ methods such as forEach, map reduce
Consider my implementation for map that goes like this :
Array.prototype.myMap = function (callbackFn) {
var res =[];
for(var i=0; i<this.length; i++){
var k = callbackFn(this[i], i);
res.push(k)
}
return res;
};
Any standard implementation I find on internet would be something like this:
var k = callbackFn.call(this, this[i], i);
For now, Ignore some of the edge cases, for e.g undefined in Sparse array.
But is there a difference if I invoke the callbackFn with call or without call