Why do you think they decided to do this? Strict mode is to allow folks to transition their code to the new standard - and the new standard has made this decision to fix a flaw in JavaScript - it acknowledges its a hack to return the global object in this case.
So I'm less editorialising and more pointing out what is already known. Hope this helps.
It's why ES5 has bind to get around this.
Example from MDN [1]
this.x = 9;
var module = {
x: 81,
getX: function() { return this.x; }
};
module.getX(); // 81
var getX = module.getX;
getX(); // 9, because in this case, "this" refers to the global object
// Create a new function with 'this' bound to module
var boundGetX = getX.bind(module);
boundGetX(); // 81
To make the above example work without bind, you need to take a copy of the reference to this, And use that copy. Thus the kludge: var module = {
x: 81,
that: this,
getX: function() { return that.x; }
};
Of course, if you run in strict mode (ES5) the original example will return undefined, because you are now expected to specify this via call, apply or bind.1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...