</>Frontend Interviews

50 JavaScript interview questions that reveal how you reason

A structured JavaScript interview question set covering language behavior, asynchronous code, browser APIs, implementation, and senior-level tradeoffs.

A useful JavaScript question should reveal a mental model, not reward a memorized sentence. Use these groups to practice explaining what happens, why it happens, and how you would verify it.

01

Language behavior

  • How do lexical scope and the scope chain affect a closure?
  • When does `this` depend on the call site, and when does it not?
  • What practical bugs can implicit coercion introduce?
  • How do prototypes support delegation?
  • What changes when a module is evaluated more than once?
  • How do property descriptors affect an API?
  • When would a symbol be useful?
  • How do shallow and deep copies differ?
  • What makes two values equal under different equality operations?
  • How would you explain temporal dead zones?
02

Async JavaScript and the browser

  • Describe one event-loop turn involving a task and queued microtasks.
  • How should a UI cancel a request that is no longer relevant?
  • What causes an unhandled promise rejection?
  • How would you limit concurrency for a batch of requests?
  • How can two callers share one in-flight request?
  • When is `Promise.allSettled` more useful than `Promise.all`?
  • How do you prevent stale responses from replacing fresh data?
  • What should happen to a cache entry after the loader rejects?
  • How do timers behave in an inactive tab?
  • Where can backpressure appear in a frontend system?
03

Implementation and verification

  • Implement debounce with cancellation.
  • Implement throttle and explain its leading and trailing behavior.
  • Create an event emitter with unsubscribe support.
  • Build a request cache with TTL and in-flight deduplication.
  • Flatten nested data without mutating the input.
  • Write a retry helper with an explicit stopping policy.
  • Implement a small task scheduler with a concurrency limit.
  • Normalize server data into an entity map.
  • Create a memoization helper and describe its invalidation limits.
  • Design tests for a function that depends on time.
04

Senior-level discussion

  • Where should runtime validation sit in a typed frontend?
  • How do you evolve a shared client API without breaking consumers?
  • What should be observable in a request layer?
  • How would you investigate a long task in production?
  • When is a web worker justified?
  • How do bundle boundaries affect runtime behavior?
  • How would you design graceful degradation?
  • What security assumptions should never live only in client code?
  • How do you make error handling consistent without hiding context?
  • Which browser constraints would change your architecture?
05

How to practice the questions

  • Answer in three passes: mechanism, concrete example, and tradeoff.
  • Write code only after stating the contract and important edge cases.
  • Verify one success case, one boundary case, and one failure path.
  • Record weak explanations as practice topics rather than memorizing longer scripts.
  • Finish by naming what evidence would change your decision.

Turn the guide into a retry

Choose one section, practice it under interview conditions, review the evidence, and repeat the same skill with a new prompt. Improvement becomes reliable when it survives a different context.

Start a mock interview