How JS Runs
Scope Chain
Understanding this
Closures
Interview Lab
Guides
Buy me a coffee
EN
Closures
ℹ️
One piece of code, two questions: this follows how the function is called; a closure follows where it was created.
JavaScript Code Editor
Directly edit or paste custom code
Step 0 of 0
←
→
Step
Space
Run
Press → (Step) or Space (Run)
◀
▶ Run Auto
▶
Phase 1: Compilation
(Hoisting & Memory Setup)
➔
Phase 2: Execution
(Line-by-line Evaluation)
Execution Step Breakdown
Press "→" / click "▶" to step line-by-line, or press "Space" / click "▶ Run" for auto-play.
Written guides
How Closures Work in JavaScript