Back to Course
Printable Cheat Sheet
ToolMate Technical Interview Revision Deck • JavaScriptUpdated 2026
JavaScript Core & Runtime Interview Cheat Sheet
Event loop phases, prototype chains, closures, async mechanics & memory management.
Top Interview Golden Rules & Senior Principles
- JavaScript is single-threaded; asynchronous concurrency is orchestrated by the Event Loop and libuv/browser APIs.
- Microtasks (Promise.then, queueMicrotask, MutationObserver) ALWAYS drain before the next Macrotask (setTimeout, setInterval, I/O).
- Closures retain references to outer scope variables in the heap, not copies; beware memory leaks in unclosed handlers.
- Arrow functions do not bind their own 'this', 'arguments', or 'prototype'; they lexically capture enclosing context.
- Use WeakMap / WeakSet for metadata or caching keys without blocking garbage collection.
Event Loop & Task Priority Execution Order
Synchronous Execution
Call Stack (LIFO)
Executes top-level synchronous code immediately until stack frames empty.
Microtask Queue (High Priority)
Promise.then() / catch(), queueMicrotask()
Completely drained after the current script run, before any browser render or Macrotask.
Gotcha: An infinite recursive microtask loop starves the event loop and locks UI rendering.
Macrotask Queue (Task Queue)
setTimeout(fn, 0), setInterval(), setImmediate()
Processed one task per event loop tick, followed by microtask check and render updates.
Prototypes & Inheritance
Prototype Chain
obj.__proto__ === Object.getPrototypeOf(obj)
Property resolution climbs up the prototype chain until matching property or null is found.
Object.create(proto)
Object.create(parentObj)
Creates a new object with the specified prototype without executing the constructor function.
Gotcha: Object.assign does shallow copy of own enumerable properties; it does not copy prototype chains.
Equality & Type Coercion Traps
Loose vs Strict Equality
== vs ===
=== checks value and type without coercion. == converts types (e.g. [] == ![] is true).
Gotcha: NaN === NaN is false! Use Number.isNaN(x) or Object.is(x, NaN).
Nullish Coalescing (??)
a ?? b
Only falls back on null or undefined. Unlike ||, it preserves 0, false, and empty string ''.
ToolMate Interview Prep • https://interview.toolmate.co.in • Free for personal study & interview preparation