Skip to content
JavaScript·Intermediate·Coding·1 min read

What is the temporal dead zone?

Short interview answer

It is the period from entering a lexical scope until a let, const, or class declaration is initialized. Access during that period throws a ReferenceError, including typeof on the uninitialized binding. This catches use-before-initialization bugs.

Example

JavaScript
{  // TDZ for `x` starts here  console.log(typeof x); // ReferenceError (not "undefined")  let x = 1;             // TDZ ends here}

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Scope and hoisting

Related questions