How does this handle shadowing? Consider, for example,
let x = 1;
function foo() { let x = 2; }
function bar() { x = 3; }
console.log(x); // 1
foo();
console.log(x); // 1
bar();
console.log(x); // 3
Without the declaration, how can you tell whether I intend to shadow or not?Edit: I note from another comment that you state
> If you want to make a global variable, you will have to explicitly write it as a property of the global object.
The example above could appear in any scope, not only the global scope. Python now has a `nonlocal` keyword (as well as the `global` keyword) to disambiguate these cases.