JAVASCRIPT GUIDE

JavaScript Hoisting and the Temporal Dead Zone

By the HireReadyAI team · 7 min read

var vs let/const, function declarations, and how to explain TDZ cleanly.

What hoisting means

Hoisting describes how JS declarations are processed before execution. It is not that code literally moves in your file — engines set up bindings during compilation of a scope.

var vs let/const

var declarations are function-scoped and initialized to undefined when hoisted. let and const are hoisted but uninitialized until the declaration line — accessing them earlier throws.

Functions

Function declarations are hoisted with their body, so you can call them above their position in a scope. Function expressions assigned to const are not callable before initialization.

Temporal dead zone

The TDZ is the time between entering scope and initializing a let/const binding. Mentioning TDZ accurately is a quick credibility signal in interviews.

All guides · HireReadyAI home

Practice this topic in a mock interview