Because when you pass a function call, you take it out of context func, so inside the callkeyword thiswill refer to windowinstead func.
windowis not a function, but callexpects to thisbe a function, so it is interrupted.
For comparison.
var AnObject = {
call: function () { console.log("this.location is: ", this.location); },
location: "This string is the location property of AnObject"
};
AnObject.call();
setTimeout(AnObject.call, 500);
source
share