Tip: hide sidebars on smaller screens for more reading space
Hoisting
mediumComplete guide with examples and interview questions · 25 min
Definition
Say it out loud in an interview — clear, simple, no textbook wording.
Hoisting is JavaScript's behavior of processing declarations during the compilation phase before running code line by line. It explains why you can sometimes call a function before its declaration — and why let before declaration throws.
Quick Stats
25
Minutes
medium
Difficulty
4
Interview Q's
Key takeaways
- •var declarations are hoisted and initialized as undefined
- •let and const are hoisted but stay in the temporal dead zone until initialized
- •Function declarations are fully hoisted; function expressions are not
- •Hoisting is about compile-time memory allocation, not moving code visually
Track your mastery
Sign in to save Q&A scores, coding challenge progress, points, and streaks across devices.
Sign in to save progress