Why would the following be the result in ES5 non-strict mode?
Object.prototype.toString.call(null);
=> [object Null]
given that
Object.prototype.toString.call(window);
=> [object global]
Shouldn’t the two lines be identical in non-strict mode, since someFunction.call(null) should be equivalent to someFunction() which should be equivalent to someFunction.call(window)?
According to ES5, when entering function code in non–strict mode:
so yes, it seems that
thisshould default to the global object. But in §15.3.4.4 Function.prototype.call there is:Finally: