CodeSnatch Logo
 ██████╗ ██████╗ ██████╗ ███████╗    ███████╗███╗   ██╗ █████╗ ████████╗ ██████╗██╗  ██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝    ██╔════╝████╗  ██║██╔══██╗╚══██╔══╝██╔════╝██║  ██║██║     ██║   ██║██║  ██║█████╗      ███████╗██╔██╗ ██║███████║   ██║   ██║     ███████║██║     ██║   ██║██║  ██║██╔══╝      ╚════██║██║╚██╗██║██╔══██║   ██║   ██║     ██╔══██║╚██████╗╚██████╔╝██████╔╝███████╗    ███████║██║ ╚████║██║  ██║   ██║   ╚██████╗██║  ██║ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝    ╚══════╝╚═╝  ╚═══╝╚═╝  ╚═╝   ╚═╝    ╚═════╝╚═╝  ╚═╝

Learn · Earn · Connect

Tags

Lexical Scope

Lexical Scope

0 lessons
3 question banks
1 community item

js-lexical-scope

Question Banks

3 items
Question Bank

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
quiz
interview-prep
closures
js-lexical-scope

1.1k

11

Medium
Question Bank

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
quiz
closures
js-lexical-scope
interview-prep

417

12

Medium
Question Bank

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
quiz
closures
js-lexical-scope
interview-prep

354

11

Medium

Community

1 item
Article

Hoisting: The Mental Model That Finally Stuck

The two-phase entry into every scope: creation phase creates every declaration's binding, execution phase runs the code. Once that order is fixed in your head, var/let/const/TDZ behaviour is mechanical.

js-hoisting
scope
js-lexical-scope
fundamentals
interview-prep

362

12

4.4 (13)

Feb 18, 2026

by @oliviadelgado