JavaScript

What is the Temporal Dead Zone?

Hard
4
Added
The period between entering scope and declaration where let/const variables cannot be accessed.

Solution Code

JavaScript
console.log(x); // ReferenceError
let x = 5;
Explanation
Variables exist in TDZ but cannot be accessed until declaration.

Guided Hints

Compare with var hoisting
Why was TDZ introduced?