JS Daily #34 - Hoisting of Let Variables

What is the output of following code?

let a = 10;

The output is:

ReferenceError: Cannot access 'a' before initialization

Variables declared using let are not hoisted. During the parsing step, JavaScript is aware about the variable. But, till line 2, it will keep the variable in Temporal Dead Zone. That means, we cannot use the code before the variable declaration, as mentioned in the error message.