I don't see the "exception to the exception", he is saying that if strict mode is on, "this" isn't the global object when saying foo(), it's undefined. And that's true.
It's possible to both have "use strict" and "this" be the global object (i.e. it's not true that it's never the global object), as simple as...
"use strict"; // global scope
var x = 1;
(function() {
"use strict";
return this.x;
}).call(this);
I am not sure that's quite what you want. Declaring x as a 'var' does not make it a property on the global object. Your example will return an 'undefined'.
I think this is what you want
"use strict";
this.x = 1;
var ret = (function() {
"use strict";
return this.x;
}).call(this);
console.log(ret); //returns 1
Fair point, but I thought it was clear I was referring to the first "exception", that is, calling a function like "foo()". Your example, while interesting, doesn't apply.
I'll be more clear:
> When there is no ‘.’ the keyword ‘this’ is bound to the global object window.
It's possible to both have "use strict" and "this" be the global object (i.e. it's not true that it's never the global object), as simple as...