Issue Description
The current explanation about hoisting for let is incorrect.
The document states that accessing a let variable before declaration returns undefined, but this is not true.
Both let and const are hoisted but remain in the Temporal Dead Zone (TDZ) until their declaration is initialized. Accessing them before declaration throws a ReferenceError.
Incorrect Example
console.log(myLetVar); // Undefined
let myLetVar = 5;
Correct Behavior
console.log(myLetVar);
// ReferenceError: Cannot access 'myLetVar' before initialization
let myLetVar = 5;
Issue Description
The current explanation about hoisting for let is incorrect.
The document states that accessing a let variable before declaration returns undefined, but this is not true.
Both let and const are hoisted but remain in the Temporal Dead Zone (TDZ) until their declaration is initialized. Accessing them before declaration throws a ReferenceError.
Incorrect Example
console.log(myLetVar); // Undefined
let myLetVar = 5;
Correct Behavior
console.log(myLetVar);
// ReferenceError: Cannot access 'myLetVar' before initialization
let myLetVar = 5;