const declares a block-scoped binding that must be initialized immediately and cannot be reassigned. Interviewers often use it to test scope, hoisting, and Temporal Dead Zone reasoning. section 3.1
Explain these points when comparing const with var and let:
- const participates in the Temporal Dead Zone before its declaration, so premature access raises a ReferenceError rather than producing undefined. section 3.1
- Block scope prevents the variable leakage associated with less-scoped declarations; discuss function, block, and global scope when tracing behavior. section 3.1
A const binding in a closure
const counter = outer(); preserves the returned closure, whose captured count produces 1, 2, and 3 across calls. Distinguish the const binding from the closure’s changing state.
Table 3.1 Core concepts of execution and scope
|
Topic
|
Fundamentals
|
Applied skills
|
Advanced
|
|
Execution context & scope
|
Define global/function/block scope, explain variable hoisting.
|
Trace scope chain; explain closures.
|
Debug closure bugs, analyze memory leaks; optimize lexical scoping.
|
|
The
this keyword
|
Explain
this in functions/objects, show basic usage.
|
Use
bind,
call,
apply; handle
this in arrow functions and events.
|
Solve tricky
this bugs; manage context in frameworks; design mindful APIs.
|
|
Type coercion & equality
|
Explain == vs ===, identify truthy/falsy values.
|
Prevent coercion bugs; handle edge cases; use explicit conversions.
|
Audit coercion issues, enforce linting rules; educate teams on common pitfalls.
|
|
Error handling
|
Use
try/
catch, explain sync vs async errors.
|
Handle errors in Promises/async code; create custom error types.
|
Architect global error handling; implement error boundaries; add monitoring systems.
|
Use the execution-and-scope comparison to connect const with block scope, hoisting, scope chains, and closure debugging. section 3.1










