Lab

Temporal Dead Zone (TDZ)

medium
1/6

Step Explanation

Understand what is happening first

1/6

Execution Visualizer

Watch memory, stack, queues, and output

Execution Visualizer

live
Before any code runs, JavaScript scans the file. It finds 'let name' and puts it in memory — but unlike var, it is NOT initialized to undefined. It is placed in the Temporal Dead Zone (TDZ). Any access before line 4 will throw a ReferenceError.

Call Stack

1 frame
TOP ↑
main()
frame 0
↓ BOTTOM
Global Context

Memory

2 variables

Stack Memory

namevarnew
"TDZ ⚠️"
cityvarnew
"undefined"
Console Output

awaiting output...

varfnobjarrclosure

Code Preview

Active line 1

Code

line 1
JavaScript
Tap Expand to view full code

1/6