Does 'let' override a global declaration and throws a ReferenceError?
问题 I was going through the Difference between var and let documentation example and was testing that when an undeclared variable is invoked, the global scope automatically provides a declaration for it (that's why the following snippet does not throw an error in any of the variables): x = 3; console.log(x); (function() { y=x+39; })() console.log(y); However, when one variable is declared with let after the assignment in the same global scope: x=3; let x = 42; console.log(x); One of the following