Hoisting & TDZ Playground

Before Dina runs a single line, the open house readies every room: what is in a var, function, let, const or class room before its own line runs? Then the…

Why it matters

Hoisting explains mysterious undefined bugs and the "Cannot access before initialization" error that often stops beginners. It is also why let/const are safer than var: a wrong order shows up at once as an error instead of quietly becoming undefined.

The key idea

Two phases: every name is made first, then the lines run

Common mistakes

Try it in this playground