Interview Q&A · JavaScript · 12 questions in this topic
Rapid-Fire Revision — JavaScript Interview Q&A
One-line answers spanning the whole bank — the final pass the night before the interview. Part of Scenarios & Rapid Fire · 204 questions in the JavaScript bank.
This rapid-fire round turns the JavaScript bank into short answers for a last review. The cards focus on the parts interviewers probe repeatedly: == versus ===, var/let/const scope, closures, this binding, the event loop and promise ordering. Say the answer and then name one consequence — a bug it prevents or a classic output puzzle. Name the phase — call stack, microtask queue or macrotask queue — that decides each output. Jump to the full topic from the menu when a one-liner needs the surrounding example.
== vs ===?
Answer
== coerces then compares; === compares type plus value with no conversion.
var vs let vs const?
Answer
Function-scoped hoisted var; block-scoped let/const, const single-assignment.
What is a closure?
Answer
A function bundled with its lexical birth scope — remembers outer variables.
How is this decided?
Answer
Call site: new > explicit (call/apply/bind) > implicit (receiver) > default; arrows lexical.
Microtasks vs macrotasks?
Answer
Microtasks (promises) drain fully before the next macrotask (timers/I/O).
Promise.all vs allSettled?
Answer
all fails fast with ordered results; allSettled reports every outcome.
map vs forEach?
Answer
map returns a transformed array; forEach returns undefined (side effects only).
Spread vs rest?
Answer
Same ... glyph: spread expands at use, rest collects at definition.
Prototype chain in one line?
Answer
Failed lookups walk up __proto__ links; assignment always writes own properties.
?. and ?? together?
Answer
Null-safe navigation plus nullish-only defaults (preserves 0 and empty string).
Debounce vs throttle?
Answer
Debounce fires after quiet; throttle caps rate during continuous calls.
How do you cancel a fetch?
Answer
AbortController signal passed in; abort() rejects listeners with AbortError.
Recommended resourcesAffiliate links · may earn us a commission