Frontend CoachResourcesQuestions
Sign inGet started
All interview questions

Question Bank

JavaScript Interview Questions

Senior-level JavaScript questions covering the engine internals interviewers actually probe: the event loop and microtasks, closures and memory retention, prototypes, iterators and generators, ESM internals, garbage collection, and async patterns. Each question includes a plain-English explanation and an architecture diagram.

51 questions — free to read, with quizzes and AI-scored practice for members.

JavaScript51 questions

What is the difference between == and === in JavaScript, and why should we avoid using ==?juniorWhat is the difference between `null` and `undefined` in JavaScript?juniorWhat is a callback function in JavaScript and why is it useful?juniorWhat is event bubbling in the DOM and how do you stop it?juniorWhat is the difference between `var`, `let`, and `const` in JavaScript?juniorWhat are arrow functions in JavaScript and how do they differ from regular functions?juniorHow do event capturing, bubbling, and delegation work in the DOM, and how would you build a delegated event system for a list with thousands of interactive rows?midCan you explain closures in JavaScript with a real-world analogy?midHow does the JavaScript microtask queue differ from the macrotask queue, and how does this affect the execution order of Promises, queueMicrotask, setTimeout, and MutationObserver?midHow does JavaScript type coercion actually work under the hood — what roles do ToPrimitive, valueOf, and toString play, and why does [] + {} differ from {} + []?midWhat are currying, partial application, and function composition in JavaScript — how do you implement curry and pipe, and where do these patterns genuinely improve production code?midImplement a typed EventEmitter from scratch and explain how the observer and pub/sub patterns differ — including memory-leak risks from forgotten subscriptions.midHow is 'this' defined in JavaScript, and what are the differences between arrow functions and regular functions?midHow do Promise, async/await work in JavaScript, and how should errors be handled correctly?midHow do var, let, and const differ in scoping and hoisting behavior, what is the temporal dead zone, and how does the engine set up scopes before execution?midImplement debounce and throttle from scratch — including leading/trailing edge options, cancellation, and the closure mechanics that make them work.midCompare structuredClone, JSON.parse(JSON.stringify()), and manual recursive cloning — covering circular references, special types like Date/Map/Set, functions, and performance.midWhat is the difference between transpiling syntax and polyfilling APIs — how do Babel, core-js, and browserslist work together, and what does differential serving change?midExplain how the event loop, microtasks, and macrotasks work in JavaScript.midHow do call, apply, and bind control the this binding, how would you implement bind from scratch, and what happens when bound functions are used with new?midWhy does 0.1 + 0.2 !== 0.3 in JavaScript, what are safe integer limits, and how do you handle money calculations and 64-bit IDs correctly with or without BigInt?midHow do closures retain memory in JavaScript, why can a single shared scope object keep large data alive unexpectedly, and how do you diagnose closure-driven leaks in heap snapshots?seniorExplain the prototype chain and its relation to ES6 classes.seniorHow do hidden classes and inline caching improve JavaScript performance in V8?seniorWalk through implementing a Promises/A+ compliant promise from scratch — state machine, then-chaining, thenable assimilation, and why resolution must be asynchronous.seniorHow does the Node.js event loop (timers, poll, check phases, setImmediate, process.nextTick) differ from the browser event loop with its rendering pipeline and requestAnimationFrame?seniorHow does Adaptive Bitrate Streaming (ABR) handle network fluctuations?seniorHow would you design an offline-first data layer using IndexedDB with background sync — including conflict resolution when the client reconnects after hours offline?seniorHow do async generators and for await...of work, and when would you use them over Promise.all for paginated APIs, event streams, or rate-limited batch processing?seniorWhat makes code tree-shakeable, how do bundlers use ESM static structure and the sideEffects flag, and why do barrel files and class decorators defeat dead-code elimination?seniorHow does AbortController provide composable cancellation for fetch, event listeners, and custom async work — and how do you propagate one signal through layered async operations?seniorHow would you design error handling for a large frontend app — custom error classes, the cause chain, global handlers for unhandled rejections, and preserving async stack traces?seniorWhen do WeakMap and WeakSet beat Map and Set — covering private instance data, DOM node metadata, and memoization caches that must not block garbage collection?seniorHow do property descriptors, getters/setters, and Object.freeze/seal/preventExtensions work — and how do libraries use defineProperty for computed properties and API deprecation warnings?seniorHow do immutable update patterns and structural sharing work — what does Immer do with Proxies under the hood, and when does immutability help or hurt performance?seniorHow do ReadableStream, WritableStream, and TransformStream work — what is backpressure, and how would you stream-process a 500 MB file or a streaming fetch response without exhausting memory?seniorHow does the V8 JavaScript engine optimize code execution?seniorHow do JavaScript Proxy and Reflect enable reactive state, validation layers, and access control — and what are the performance costs at scale?seniorWhat is hydration in JavaScript?seniorHow do the iterator and iterable protocols work in JavaScript, and how do generators let you build lazy sequences, pausable computations, and custom iteration for data structures?seniorHow can you efficiently manage and access message data in a normalized state structure in JavaScript?seniorHow would you approach designing a TypeScript SDK for a crypto payment platform?seniorHow does Promise.all differ from Promise.any in handling rejected promises?seniorHow do you choose between Cache-First, Network-First, Stale-While-Revalidate, and Network-Only strategies in a Service Worker, and how do you handle cache versioning and invalidation?seniorWhat are the most common sources of memory leaks in JavaScript and React applications, how do you detect them with Chrome DevTools, and how do WeakRef and FinalizationRegistry help?seniorHow do ES modules differ from CommonJS at the engine level — live bindings vs value copies, static analysis, circular dependency handling, and top-level await?seniorHow does generational garbage collection work in V8 — the scavenger, mark-sweep-compact, and write barriers — and how does GC pressure show up as frame drops in real apps?seniorHow do tagged template literals work mechanically, and how do libraries like styled-components, graphql-tag, and SQL sanitizers exploit them to build safe embedded DSLs?seniorWhat problems do Symbols solve in JavaScript, and how do well-known symbols like Symbol.iterator, Symbol.toPrimitive, and Symbol.hasInstance let you customize language behavior?seniorWhat causes catastrophic backtracking in regular expressions, how can a crafted input freeze your app or server (ReDoS), and how do you write linear-time-safe patterns?seniorWhat are the key differences between CSR, SSR, and SSG in terms of when HTML is ready and user experience?senior

Practice these with AI feedback and track what you've mastered.

Sign up free

Browse other topics

ReactFrontend System DesignWeb PerformanceBrowser & Web APIsTestingBehavioral