How does this handle shadowing? Consider, for example,<p><pre><code> 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
</code></pre>
Without the declaration, how can you tell whether I intend to shadow or not?<p>Edit: I note from another comment that you state<p>> If you want to make a global variable, you will have to explicitly write it as a property of the global object.<p>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.