80%
DefinitionJavaScript is dynamically typed and single-threaded.
Primitives are copied by value; objects by reference.
Falsy values:
false, 0, -0, 0n, "", null, undefined, NaN — everything else is truthy.?? falls back only on null/undefined; || on any falsy value (so 0 || 5 is 5 but 0 ?? 5 is 0).var: function · yes, as undefined · yes
let: block · yes, but in the TDZ · yes
const: block · yes, but in the TDZ · no (objects stay mutable)
Common mistakeUsing a
let/const before its line throws a ReferenceError (temporal dead zone).DefinitionA closure is a function that remembers the variables of the scope it was created in, even after that scope has returned.
obj.method(): obj
fn() (strict mode): undefined
new Fn(): the new object
fn.call(x) / apply(x) / bind(x): x
Every object has a hidden link (
[[Prototype]]) to another object.FlowAfter each task, ALL microtasks run before the next macrotaskCall stack (sync code)→Microtasks (promises)→Render→One macrotask (timers, I/O)→repeat
TipInterview answer: "sync first, then all microtasks, then one macrotask".
Promise.all: all succeed (rejects on the first failure)
Promise.allSettled: all finish, success or failure
Promise.race: the first one settles
Promise.any: the first one succeeds
Common mistake
await inside forEach does not wait — use for…of (sequential) or Promise.all(arr.map(…)) (parallel).Debounce: run after calls stop (search box).
map/filter/slice/toSorted return new arrays; sort/splice/push/reverse mutate.ES modules:
import/export, statically analysed (tree-shaking); CommonJS: require/module.exports, loaded at runtime.Reviselet/const + TDZ, closures, this depends on the call site, prototype chain, sync → microtasks → macrotask, Promise.all for parallel work, debounce vs…