1. window does not inherit from Object.prototype
Oddly enough, according to the ECMAScript specification, the global
window object does not necessarily have to inherit from Object.prototype. In Chrome, FF, and Safari, it does, but in IE it doesn’t.
That means that using something like
window.toString.call(foo) will fail in IE, which is exactly what happened to us.
So to avoid this problem, just use
2. Some built-in Functions don’t have apply()
A related problem is that you cannot use apply() on some native functions in IE, e.g.
console.log.apply(null, ["foo", "bar", "baz"]).
Wait, this is the same error as above. Why?
window is what’s known as a “host” object and doesn’t have to inherit from Object.prototype. And since the functions on the host objects are “host” functions, they also don’t have to inherit from Function.prototype.
For more information, check out these two StackOverflow threads:
Bonus: Trivia time (if you’re into that sort of thing):