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

All topic tags

  • Abstraction
  • Accessibility
  • Adaptability
  • AI Safety
  • Algorithms
  • Amazon
  • Amortized Analysis
  • Analysis Techniques
  • API Design
  • API Gateway
  • Array Manipulation Patterns
  • Arrays
  • Arrow Functions
  • Asymptotic Analysis
  • Async / Await
  • Asynchronous Programming
  • Authentication
  • Autocomplete
  • Availability
  • Backend
  • Backtracking
  • Balanced BST
  • Bar Raiser (Amazon-style)
  • Behavioral Interview
  • Behavioral Interviews
  • Bellman-Ford Algorithm
  • BFS
  • Big-O
  • Big-Ω (Omega)
  • Binary Search
  • Binary Search Templates
  • Binary Search Tree (BST)
  • Binary Tree
  • Bit Manipulation
  • Bitmask DP
  • Blob Storage
  • C++ STL
  • Caching
  • Call Stack
  • Career
  • Career Narrative
  • Career Switcher
  • Case Study
  • CDN
  • Cheat Sheet
  • Classes & Objects
  • Clean Code
  • Closures
  • Code Organization
  • Code Template
  • Coding Interview
  • Collaboration
  • collections Module
  • Communication
  • Company-Specific
  • Comparison
  • Complexity Classes (P/NP)
  • Composition
  • Computational Geometry
  • Concurrency
  • Conditional Types
  • Conditionals
  • Connected Components
  • Consistency
  • Consistent Hashing
  • Core Values
  • Correctness
  • Craftsmanship
  • CSS Grid
  • CSS Selectors
  • CSS Variables (Custom Properties)
  • Culture Fit
  • Cycle Detection
  • Data Modeling
  • Data Structures
  • Data-Intensive Systems
  • Database
  • Dataclasses
  • Dealing with Ambiguity
  • Debugging
  • Decision Making
  • Deep Dive
  • Deque
  • Design Patterns
  • DFS
  • Dict / Set Comprehensions
  • Dijkstra's Algorithm
  • Directed Graphs
  • Display Property
  • Distributed Systems
  • Divide and Conquer
  • DOM Manipulation
  • Doubly Linked List
  • Dynamic Programming
  • E-Commerce & Marketplace
  • Efficiency
  • Embedding
  • Error Handling
  • Event Delegation
  • Event-Driven Architecture
  • FAANG
  • Fast/Slow Pointers
  • Feed Ranking
  • Fetch API
  • Fibonacci
  • Flexbox
  • Foundations
  • Framework
  • Free
  • Frequency Count
  • Frontend
  • Functional Programming
  • Fundamentals
  • GCD / LCM
  • Generators
  • Generics
  • Graph Algorithms
  • Graph Representation
  • Graphs
  • Greedy
  • Grid DP
  • Hash Map / Dictionary
  • Hash Table
  • Hashing
  • Heap
  • Higher-Order Functions
  • Hoisting
  • Hooks
  • HTML Elements
  • HTML Media (Audio/Video)
  • HTTP
  • Idempotency
  • Immutability
  • Implementation
  • In-Place
  • Influence
  • Infrastructure & Storage
  • Inorder
  • Input / Output
  • Interval Problems
  • Interview Preparation
  • Interview Strategy
  • Invariants
  • Islands / Flood Fill
  • Iteration Patterns
  • Iterators
  • itertools Module
  • JavaScript Language
  • JS Event Loop
  • JWT
  • Kadane's Algorithm
  • Kafka
  • Knapsack Problem
  • Leadership
  • Leadership Interview
  • Leadership Principles
  • Level Order
  • Lexical Scope
  • List Comprehensions
  • Logging
  • Loops & Iteration
  • Lowest Common Ancestor (LCA)
  • LRU Cache
  • Machine Learning
  • Map / Filter / Reduce
  • Mapped Types
  • Master Theorem
  • Mathematics
  • Matrix Algorithms
  • Matrix Traversal
  • Max Heap
  • Media Queries
  • Memoization
  • Merge Intervals
  • Merge Sort
  • Message Queue
  • Messaging & Communication
  • Meta
  • Microservices
  • Min Heap
  • ML System Design
  • Monitoring
  • Monotonic Stack
  • Multi-Source BFS
  • Networking
  • Number Theory
  • Object-Oriented Programming
  • Offer Negotiation
  • OpenAI
  • Ownership
  • Palindrome
  • Patterns
  • Performance
  • Performance Optimization
  • Pointers
  • Prefix Sum
  • Premium
  • Priority Queue
  • Probability Basics
  • Problem Solving
  • Promises
  • Proof Techniques
  • Python Decorators
  • Python Generators
  • Python Standard Library
  • Query Optimization
  • Queue
  • Quick Sort
  • Quiz
  • Randomized Algorithms
  • Range Queries
  • Rate Limiting
  • React
  • Real-Time
  • Recurrence Relations
  • Recursion
  • Redis
  • References
  • Regular Expressions
  • Reliability
  • Resilience
  • Responsive Design
  • REST API
  • Role-Specific
  • Saga Pattern
  • Scalability
  • Search & Discovery
  • Searching
  • Security
  • Segment Tree
  • Self-Awareness
  • Senior-Level Interviews
  • Set
  • Shortest Path
  • Simulation
  • Singly Linked List
  • Sliding Window
  • Social and Content Platforms
  • Social Media
  • Sorting
  • Space Complexity
  • Spread / Rest Operator
  • SQL
  • Stack
  • Stakeholder Management
  • STAR Method
  • Startup Culture
  • State Machine
  • Story Banking
  • Storytelling
  • Stream Processing
  • String Manipulation
  • String Matching
  • Strings
  • Stripe
  • Sweep Line
  • System Design
  • System Design Interview
  • Tabulation
  • Teamwork
  • Testing
  • Theory
  • this Keyword
  • Throttling
  • Time Complexity
  • Topological Sort
  • Tracing / Dry Run
  • Trade-offs
  • Tree Traversal
  • Trees
  • Trie / Prefix Tree
  • Trie Operations
  • Two Pointers
  • Type Guards
  • Type Hints
  • Type Narrowing
  • Type System
  • TypeScript Generics
  • Undirected Graphs
  • Union by Rank
  • Union-Find / DSU
  • Unit Testing
  • Utility
  • Utility Types
  • Vector Search
  • Web APIs
  • WebSockets
  • Weighted Graphs
  • XOR Tricks