InterviewsVector

67 interview questions and coding challenges · 9 categories · Covers ES2025

JavaScript Interview Questions & Coding Challenges

Practice 67 JavaScript interview questions and coding problems with worked solutions, edge cases, and interviewer follow-ups. Start with language fundamentals, then build up to promise concurrency, DOM patterns, and machine-coding exercises.

Quick answer

These JavaScript interview questions and coding challenges cover recurring frontend and full-stack problems: closures, the event loop, debounce and throttle, Promise combinators, deep cloning, polyfills, DOM patterns, and machine-coding tasks. Each challenge links to a worked solution with edge cases and interviewer follow-ups.

Suggested learning path

Categories are ordered as a ramp — each stage leans on the ones before it. Work top to bottom, or jump to wherever you left off.

  1. JavaScript FundamentalsContinue hereHow the language actually works — everything else builds on these four.0/4
  2. Modern JavaScript (ES2023–ES2025)The 2024–2025 built-ins that replaced utilities you used to hand-roll.0/4
  3. Debounce, Throttle & TimersFirst implementations: closures and timers driving real UI patterns.0/5
  4. Promises & Async PatternsThe biggest category — combinators first, then the patterns they compose into.0/15
  5. Functional Programming PatternsClosure fluency: curry, compose, memoize.0/7
  6. Objects, Arrays & CloningReferences, recursion, and equality — the data-structure drills.0/6
  7. Polyfills & Language InternalsRebuild the standard library to prove you know the spec.0/13
  8. DOM, Events & UI PatternsBridge language knowledge into framework internals.0/8
  9. Machine Coding PatternsCompose everything into small working systems, under interview time.0/5
0 / 67 completed

JavaScript Fundamentals

The concepts every other question builds on. Interviewers probe these to see whether you understand how the language actually works, not just its syntax.

  • How the call stack, microtask queue, and macrotask queue decide execution order — with the output-prediction questions interviewers love.

    intermediateVery common
  • What a closure really is, why loops with var trip people up, and how closures power memoization, once(), and module patterns.

    beginnerVery common
  • The four binding rules, arrow-function behavior, and the lost-this bugs that call, apply, and bind exist to fix.

    intermediateVery common
  • The prototype chain, __proto__ vs prototype, and what class syntax actually does under the hood.

    intermediateCommon

Modern JavaScript (ES2023–ES2025)

Recent language features that are now fair game in interviews — and often the sanctioned replacement for utilities you used to hand-roll.

  • Object.groupBy, Promise.withResolvers, Set methods, iterator helpers, and the other additions worth knowing in interviews.

    intermediateCommon
  • The ES2024 way to create a promise you settle from outside — and how to implement the deferred pattern it replaces.

    intermediateCommon
  • map, filter, take, and drop directly on iterators (ES2025): lazy evaluation without loading everything into an array.

    advancedRare
  • Implement groupBy from scratch, then meet the ES2024 built-ins — including the null-prototype result and Map.groupBy for object keys.

    intermediateCommon

Debounce, Throttle & Timers

Rate-limiting user input and understanding JavaScript timers — among the most frequently asked practical frontend questions.

  • Implement debounce from scratch, with leading/trailing options and the classic search-input use case.

    beginnerVery common
  • Implement throttle and know exactly when to reach for it instead of debounce (scroll, resize, mousemove).

    beginnerVery common
  • Rebuild setTimeout on top of requestAnimationFrame to show you understand timer scheduling and drift.

    advancedRare
  • Implement setInterval with setTimeout recursion — and fix the drift problems of the native version.

    intermediateCommon
  • Track and clear every active timeout and interval — a utility question about monkey-patching globals safely.

    intermediateRare

Promises & Async Patterns

The largest interview category: reimplement the Promise combinators, then compose them into retry, batching, and concurrency-control patterns used in real applications.

  • Implement a spec-faithful Promise with then chaining, state transitions, and async resolution.

    advancedVery common
  • Implement Promise.all: aggregate results in order, fail fast on the first rejection.

    intermediateVery common
  • Implement allSettled: wait for every promise and report per-promise status objects.

    intermediateCommon
  • Implement Promise.any with AggregateError semantics: first success wins, all failures reject.

    intermediateCommon
  • Implement Promise.race and use it for the timeout pattern every senior interview touches.

    beginnerCommon
  • Implement finally correctly: pass values through, and don't swallow rejections.

    intermediateCommon
  • Run N async tasks with at most K in flight — the production-style p-limit pattern, including ordering and failure trade-offs.

    advancedVery common
  • Cancel fetch requests, add timeouts with AbortSignal.timeout, and write abortable async utilities.

    intermediateCommon
  • Retry a failing async operation N times with backoff — a small function with big production implications.

    intermediateCommon
  • Process a large list of async tasks in fixed-size sequential batches to protect downstream services.

    intermediateCommon
  • Run async tasks one after another and understand why reduce-with-promises works.

    beginnerCommon
  • Fire all tasks at once and gather results — plus what parallel really means on a single thread.

    beginnerCommon
  • First settled task wins: build the primitive behind timeouts and fastest-source fetching.

    beginnerRare
  • Convert error-first callback APIs into promise-returning functions, like Node's util.promisify.

    intermediateCommon
  • Cache in-flight and resolved requests to deduplicate API calls — with cache invalidation trade-offs.

    intermediateCommon

Functional Programming Patterns

Currying, composition, and the lodash utilities interviewers ask you to rebuild to test closure fluency.

  • Transform f(a, b, c) into f(a)(b)(c): the classic closure exercise, with arity handling.

    intermediateVery common
  • Compose functions left-to-right into a pipeline — the one-liner with a lot of interview depth.

    intermediateCommon
  • Pre-fill leading arguments of a function — partial application, and how it differs from currying.

    intermediateRare
  • Guarantee a function runs exactly once and returns its cached result forever after.

    beginnerCommon
  • Cache function results by argument key — and discuss cache-key strategy and memory trade-offs.

    intermediateVery common
  • A single-slot memoizer that remembers only the previous call — the pattern behind React's useMemo.

    intermediateCommon

Objects, Arrays & Cloning

Deep equality, deep cloning, and array manipulation — questions that expose how well you understand references, recursion, and edge cases.

  • When to use the built-in structuredClone, where it fails (functions, prototypes), and how it compares to JSON round-tripping.

    intermediateCommon
  • Recursively clone nested objects and arrays, handling cycles with a WeakMap.

    advancedVery common
  • Structural equality for nested data: type checks, key comparison, and recursion done right.

    intermediateCommon
  • Flatten arbitrarily nested arrays recursively and iteratively — then compare with Array.prototype.flat.

    beginnerVery common
  • Turn nested objects into dot-path keys ({ 'a.b.c': 1 }) and back — the transform behind form libraries and analytics events.

    intermediateVery common
  • Use a Proxy to support arr[-1] like Python — a practical introduction to Proxy traps.

    advancedRare

Polyfills & Language Internals

Rebuild the standard library. These questions verify you know what the built-ins actually do, including the edge cases.

  • Implement call from scratch: temporary method assignment and why Symbol keys avoid collisions.

    intermediateCommon
  • Same trick as call but with an arguments array — plus the subtle differences that interviewers probe.

    intermediateCommon
  • Implement bind including partial application and the new-operator edge case most candidates miss.

    advancedVery common
  • Implement myNew(Constructor, ...args): prototype linking, this binding, and the return-object override rule.

    intermediateCommon
  • Walk the prototype chain by hand, then meet Symbol.hasInstance — and learn where instanceof lies to you.

    intermediateCommon
  • Copy enumerable own properties across sources, with getter evaluation and null-target errors.

    intermediateRare
  • The equality that fixes === for NaN and -0: tiny implementation, classic trivia follow-ups.

    beginnerRare
  • Reimplement typeof with Object.prototype.toString and learn why typeof null === 'object'.

    beginnerRare
  • Serialize values by hand: undefined, functions, cycles, and all the special cases JSON defines.

    advancedCommon
  • Write a small recursive-descent parser — the deepest polyfill question in the set.

    advancedRare
  • Implement reduce including the no-initial-value case and empty-array TypeError.

    intermediateCommon
  • Strip whitespace without regex catastrophes — and enumerate what counts as whitespace.

    beginnerRare
  • Split source text into tokens — a warm-up for parsing questions like JSON.parse.

    intermediateRare

DOM, Events & UI Patterns

Event emitters, history, virtual DOM, and state management — the frontend-system questions that bridge JavaScript knowledge and framework internals.

  • Implement on, off, once, and emit — the pub/sub pattern behind Node streams and countless libraries.

    intermediateVery common
  • Implement delegate(root, selector, handler) with closest() — one listener for a thousand rows, and why frameworks did exactly this.

    intermediateVery common
  • Model back/forward/push navigation with an index and a stack — the core of every router.

    intermediateCommon
  • Turn real DOM into a plain-object tree — the first half of understanding how React represents UI.

    advancedRare
  • Diff two virtual trees and apply minimal DOM mutations — the reconciliation step that makes the virtual DOM worth having.

    advancedCommon
  • Rebuild the classnames utility: strings, arrays, objects, and nested combinations.

    beginnerCommon
  • A mini Redux store with Immer-style draft mutations — reducers, subscriptions, and immutability.

    advancedRare

Machine Coding Patterns

Small systems, not single functions: the 30–45 minute build-a-working-thing questions used to test composition, state, and browser API fluency.

  • O(1) get/put with least-recently-used eviction — the Map insertion-order trick, and the linked-list version interviewers ask about.

    advancedVery common
  • Debounce, cancellation, and stale-response guards composed into a search box that never shows the wrong results.

    advancedVery common
  • IntersectionObserver, in-flight guards, end-of-data states, and the sentinel pattern — the pagination question every feed team asks.

    advancedVery common
  • A dependency-free rating component: event delegation, hover preview vs committed state, keyboard support, and the ARIA pattern.

    intermediateCommon
  • A concurrency-limited scheduler with priorities and cancellation — the pool question upgraded to the API-design round.

    advancedCommon

How these challenges are selected

The catalog prioritizes problems that reveal JavaScript behavior, implementation trade-offs, and edge-case reasoning—not syntax trivia. Difficulty reflects the reasoning and implementation depth required; interview-frequency labels are editorial estimates and should be used as a practice priority, not as an employer-specific guarantee.

JavaScript interview question and coding challenge FAQs

Which JavaScript interview questions and coding challenges should I practice?
Start with closures, the event loop, this-binding, debounce and throttle, Promise.all-style combinators, deep clone, currying, bind, and event emitters. For senior frontend interviews, add promise concurrency, cancellation, LRU caches, typeahead, infinite scroll, and small DOM or machine-coding exercises.
What JavaScript topics are asked most in interviews?
Closures, the event loop, promises, and this-binding dominate conceptual rounds, while debounce/throttle, Promise.all-style combinators, deep clone, and Function.prototype.bind are the most common implementation questions. Senior loops increasingly add concurrency control (promise pools) and cancellation with AbortController.
Should I memorize polyfill implementations?
No — interviewers check whether you understand the behavior you're recreating: edge cases, spec semantics, and why the built-in works the way it does. Practice deriving each implementation from the behavior you can describe, not reciting code. If you can explain call vs apply vs bind and the no-initial-value case of reduce, the code follows.
Are ES2024 and ES2025 features fair game in interviews?
Yes, increasingly. Object.groupBy, Promise.withResolvers, Set operations like intersection and union, and iterator helpers now appear in senior frontend interviews — often as a follow-up: 'you implemented it; does the language provide it now?' Knowing the modern built-in and its limits is a strong senior signal.
How should I practice these questions?
Work category by category: read the problem, implement it yourself in an editor before reading the solution, then compare against the edge cases covered in the article. Re-implement from memory two days later. Use the completion tracker on this page to keep your place — most candidates need two passes through the catalog over three to four weeks.
Do these questions cover React or only plain JavaScript?
The catalog is deliberately framework-free — that's what JavaScript rounds test. But many questions are the internals of framework features: memoizeLast is React's useMemo, the event emitter is Node streams, and the virtual DOM pair shows how React represents UI. Mastering them makes framework questions easier.

Keep going

JavaScript questions are one round. Compare the language and runtime trade-offs with the Java interview knowledge hub, connect the language fundamentals to the Angular interview knowledge hub, then pair them with system design deep dives and the Distributed Systems field manual for senior loops, or generate a personalized prep roadmap.

Last updated