JavaScript: Closures & Scope
Closures are one of JavaScript's most powerful — and most misunderstood — features. This quiz tests whether you can predict what code actually does, not just recite the definition.
Questions cover lexical scope, the difference between function and block scope, hoisting, the Temporal Dead Zone, and classic closure gotchas like the loop-variable problem — including code snippets where you need to trace through the output.
If var vs. let inside a loop has ever surprised you, this quiz will test whether you actually know why.
Start quiz →
Opens in a new tab on Cletica
Sample questions3 of 13 shown
Q1
What is a closure in JavaScript?
Q2
What will be logged to the console?
Q3
Which of the following correctly demonstrate closure? (Select all that apply)
What This Quiz Covers
- What a closure is and how it captures variables
- Lexical scope and the scope chain
- Function scope vs. block scope
- Hoisting and the Temporal Dead Zone (TDZ)
- The classic loop-closure problem with var
- Tracing console output through nested functions
Cletica
Want to create your own quiz?
Build surveys and quizzes, share with anyone, collect responses — free to start.
Try Cletica for free →