Temporal Dead Zone (TDZ)

When you have declared a variable using const or let keywords inside a scope (a pair of curly brackets), the TDZ refers to the part of code

  • starting from the 'start' curly bracket of the scope

  • to the like of the code where the variable is declared

It basically means the variable cannot be used in this part of the code even though it belongs to the scope.

Last updated