Closures
closures
Question Banks
JavaScript Language Trivia
Beginner JS quirks to predict and explain: `==` vs `===`, hoisting, `this` binding in different call sites, and one quick closure trace.
JavaScript Scope and Closure Code Traces
Six traces covering the `var` loop-closure pitfall, parameter shadowing, IIFE captures, block scope leaks, and `delete` on locals.
JavaScript Closures and Private State Quiz
Build the classic closure patterns: encapsulated counters, lexical-scope inheritance through nested functions, and constructor-level private fields.
JavaScript var Loop Closure: Two Explanations Quiz
The classic var-in-a-for-loop closure trap, explained two ways (shared `i` binding and the IIFE capture fix), plus two companions on the `let` per-iteration binding and a queueMicrotask version of the trap.
JavaScript Inherit x From Function b: Two Approaches Quiz
Make constructor `b` inherit `x` from constructor `a`: parent-constructor call via `Function.prototype.call`, ES6 `extends` + `super`, `Object.create` chaining, and an arrow-vs-constructor explainer.
JavaScript Add-N via Currying: Two Approaches Quiz
Two seeded ways to build an `adder(n)` that adds `n` to its argument (closure-returning-function and `Function.prototype.bind`), plus two companions on three-arg currying and a generic curry helper.
Community
Mastering Closures in JavaScript
What a closure actually captures (variable bindings, not values), why the loop-with-var bug exists, and the real-world patterns that lean on closures: module pattern, currying, and React useCallback.
JS Questions I Ask Senior Frontend Candidates
A 5-question screen I run on every senior frontend candidate. Each one has a junior answer that passes, a mid-level answer that almost passes, and a senior answer I am actually looking for.
The JavaScript Debugging Stories From Real PRs
Four solutions to the same closure-and-var trap, plus one bug that took me an afternoon. 5 questions, all from real PRs where the test passed and the user-visible behavior was still wrong.
