A compact set of common JavaScript interview questions with concise answers.
The event loop checks the call stack; when empty it drains microtasks (promises) then runs one macrotask (e.g., setTimeout) and repeats.
var is function-scoped and hoisted; let/const are block-scoped. const can't be reassigned.
A closure is a function that retains access to its lexical scope even when executed elsewhere — useful for private state.
== coerces types before comparing; === is strict (no coercion).
Determined by call-site: default/global, object method (implicit), explicit (call/apply), new, or lexical for arrow functions.
class is syntax sugar over prototype-based inheritance. Objects inherit via the prototype chain.
call(thisArg, ...), apply(thisArg, [args]) invoke immediately; bind(thisArg) returns a bound function.
Promises represent eventual results; async/await is syntactic sugar for working with promises.
Microtasks (promises) run after the current stack but before the next macrotask (timers, I/O).
Function and var declarations are hoisted. let/const are hoisted but in TDZ until initialized.