Why do I get the following error in the google dev console when loading the script from a web page?
But if I step through the code with the dev tool debugger the err
this
is not bound to the global object in strict mode.
The value of this
is not converted to the global object when it is null or undefined.
JavaScript
function testFunc() {
return this;
}
var testvar = testFunc();
In non-strict mode, the value of testvar
is the global object, but in strict mode the value is undefined.
http://msdn.microsoft.com/en-us/library/br230269(v=vs.94).aspx
That solves most of it. I still can't explain why it works while stepping through the code in the chrome debugger.