I have executed the following code and I found that I was unable to access the variable all the time in global scope.
console.log(b); let b = 1;
VM12265:1 Uncaught ReferenceError: b is not defined
at <anonymous>:1:13
(anonymous) @ VM12265:1
let b = 1; console.log(b);
VM12318:1 Uncaught SyntaxError: Identifier 'b' has already been declared
at <anonymous>:1:1
(anonymous) @ VM12318:1
console.log(b);
VM12368:1 Uncaught ReferenceError: b is not defined
at <anonymous>:1:13
I would like to know what happened to the variable b in step 3 once the step 1 and step 2 is executed.