liveBook · Manning

Hoisting

As explained in Acing the Frontend Interview

Hoisting is JavaScript's initialization behavior that makes certain declarations available according to their scope before their source position is reached during execution.

Hoisting describes how JavaScript makes declarations available according to scope before execution reaches their source position. Interview questions use it to test execution phases, variable resolution, and the difference between var hoisting and the Temporal Dead Zone for let and const. section 3.1

A Temporal Dead Zone failure

In strict mode, calling greet logs message before its declaration: function greet() { console.log(message); let message = "Hello, world!"; } greet(); This throws ReferenceError: Cannot access 'message' before initialization. Explain the creation and execution phases rather than treating hoisting as simple textual movement. section 3.1

How Acing the Frontend Interview covers it

How deep it goes
Explains creation and execution phases through a TDZ example, while stopping short of broader implementation internals.
Examples
Uses a strict-mode function that reads a let binding before initialization and produces a ReferenceError.
What you can do after
Evaluate hoisting questions by distinguishing var behavior from let and const Temporal Dead Zone behavior.
How it connects
Connects hoisting with scope, execution context, variable resolution, and the Temporal Dead Zone.

Also explained in

Compare how 3 books explain hoisting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Frontend Interview. The section links point to the parts of the book it draws on.