Phase 4 · JavaScript

Topics

Hoisting

Part of the Frontend Developer Roadmap.

Summary

JavaScript's behavior of moving variable and function declarations to the top of their scope during compilation — `var` and functions hoist differently than `let`/`const`. Hoisting is best understood as the result of how JavaScript creates bindings before executing code, rather than as literal source-code movement.

How to Learn This

  • 1Log a `var` variable before its declaration line and observe `undefined`. Validate your understanding by applying it in a small practical example.
  • 2Try the same with a `let` variable and see the ReferenceError. Inspect the result in DevTools or the console and explain what you observed.
  • 3Learn that function declarations are fully hoisted, but function expressions aren't.
InsideEdge

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — free on the InsideEdge app.

Download
InsideEdge