In Javascript, we can add global variables at any point using the window object:
'use strict';
var a = 1;
function test() {
window.b = 2;
}
test();
console.log(a); // a
console.log(b); // b
Is there a similar (or non-similar!) way to do assign vars to the current module scope in ES6?
Thanks
Module environments consist of so called declarative environment records:
In contrast to the global environment consist of an object environment record:
Just like with function environments (they are also declarative), there is no way to access the scope from another scope.