With developer tools open in IE9, this code works :
var log = Function.prototype.bind(console.log, console);
But if I type
console.log(console, console.log);
var log = console.log.bind(console);
then I get this :

Why ?
Is that a known IE bug or a normal behavior ?
Does it affect other functions (I had no problem with window.alert which is also native) ?
As the related answer says, it is simply because the
logfunction from theconsoleobject in IE doesn't inherit fromFunction. It's a host object, and it uses whatever rules IE sees fit.But it's a function-like. That's why using
Function.prototype.bindworks, just like usingArray.prototype.forEachworks on array-like objects. (Hint: NodeLists and HTMLCollections.)It's not a bug per se, because there is no specification talking about the
consoleobject. The DOM living standard doesn't even mention it. So each browser implements this object the way it wants to.And it does mean that the
window.alertfunction is subject to the same problems. We're lucky that it works so well across browsers.That's IE. Deal with it. Although IE9 is far better than IE8, it's still way worse than the other modern browsers.