DEV Community

Cover image for Understanding JavaScript Temporal Dead Zone
Mark Matthew Vergara
Mark Matthew Vergara

Posted on

Understanding JavaScript Temporal Dead Zone

What is the Temporal Dead Zone (TDZ)?

The Temporal Dead Zone refers to the zone in which a variable has been declared but has not yet been initialized. You can identify the Temporal Dead Zone by looking at code examples with comments labeled //Temporal Dead Zone, as shown in the pictures below. But Different types of variables in a true javascript way, we face different behaviors


let Behavior Inside TDZ (console.log is also within the TDZ)
Let Variable Temporal Dead Zone


const Behavior Inside TDZ (console.log is also within the TDZ)
Tagalog Var Variable Temporal Dead Zone

var Behavior Inside TDZ (console.log is also within the TDZ)
Tagalog Var Variable Temporal Dead Zone

More info about TemporalDeadZone Here

Top comments (0)