Hoisting JavaScript Interview Questions
5 curated hoisting interview questions for JavaScript — with short answers, detailed explanations, and interview tips. Ideal for Fresh through Tech Lead prep.
What is hoisting in JavaScript?
Fresh / InternConcept
How does hoisting differ between function declarations and function expressions?
JuniorComparison
What is logged and why? ```js console.log(a); console.log(b); var a = 1; let b = 2; ```
Mid-LevelCode Output
Are ES6 classes hoisted? Can you use a class before its declaration?
Mid-LevelConcept
In non-strict sloppy mode, what happens if two function declarations share the same name in one scope? How should a team prevent related bugs?
SeniorBest Practice