JavaScript Interview Prep
Practice the JavaScript questions that actually appear in frontend engineering interviews — event loop, closures, async patterns, and live coding challenges. Get evaluated like a senior engineer, with rubric-based feedback on every answer.
Explain the event loop and microtask queue.
Hint: Cover call stack, macrotask queue, microtask queue ordering, and a concrete async example.
What is a closure and how would you use one?
Hint: Define closure, show data encapsulation, then implement debounce or memoize as an example.
Difference between var, let, and const.
Hint: Cover hoisting, temporal dead zone, block vs function scope, and reassignment rules.
Explain prototypal inheritance in JavaScript.
Hint: Cover __proto__, Object.create, constructor functions, and how the prototype chain is traversed.
What is the difference between Promise.all, Promise.race, and Promise.allSettled?
Hint: Cover behavior on rejection, use cases for each, and when to prefer one over another.
Implement a simple version of Promise.all from scratch.
Hint: Track resolved count, reject on first failure, resolve when all complete.
Explain async/await and how it relates to Promises.
Hint: Show that async functions return Promises, await pauses execution, and error handling with try/catch.
What are the pitfalls of using async/await in loops?
Hint: Cover sequential vs parallel execution, why for...of with await is sequential, and when to use Promise.all instead.
Implement debounce from scratch.
Hint: Use closure, clearTimeout, and setTimeout. Handle leading edge variant as a bonus.
Implement throttle from scratch.
Hint: Track last execution time or use a flag. Explain the difference from debounce.
Deep clone an object without using JSON.stringify.
Hint: Handle circular references, Date, arrays, null, and nested objects recursively.
Implement a curry function.
Hint: Return a function that accumulates arguments until the expected arity is met, then invokes the original.
Call stack, task queues, microtasks, macrotasks. How JavaScript handles concurrency in a single-threaded runtime.
Lexical scoping, closure capture, IIFE patterns, and classic interview traps with var in loops.
Prototype chain, Object.create, constructor functions, class syntax sugar, and instanceof.
Default, implicit, explicit (call/apply/bind), and arrow function binding rules. Tricky this contexts in callbacks.
Destructuring, spread/rest, generators, symbols, WeakMap, optional chaining, nullish coalescing, and modules.
Types vs interfaces, generics, utility types (Partial, Pick, Omit), type narrowing, and structural typing.
Frontend JavaScript interviews cover: the event loop and microtask queue, closures and scope, prototypal inheritance and the prototype chain, async patterns (Promises, async/await, Promise.all), var/let/const and the temporal dead zone, this binding and call/apply/bind, ES6+ features (destructuring, spread, generators, modules), and coding challenges like implementing debounce, throttle, deep clone, and curry.
The JavaScript event loop continuously checks the call stack and task queues. When the call stack is empty, it first processes all microtasks (Promise callbacks, queueMicrotask) before picking the next macrotask (setTimeout, setInterval, I/O). This means Promise .then() callbacks always run before setTimeout callbacks, even with a 0ms delay. Understanding this ordering is critical for frontend interviews.
A closure is a function that retains access to its outer scope's variables even after the outer function has returned. Closures are used for: data encapsulation and private variables, factory functions, memoization, event handlers that need access to loop variables, and implementing module-like patterns. Common interview questions ask you to implement debounce, throttle, or once() using closures.
Common JavaScript coding challenges include: implementing debounce and throttle, deep clone an object, flatten a nested array, implement Promise.all and Promise.race, curry a function, implement a simple event emitter, memoize a function, implement bind/call/apply, flatten an object, and implement a LRU cache. For frontend roles, challenges also include DOM manipulation and building small utilities.
Answer real JavaScript interview questions, get rubric-based scoring, and identify your weak spots with a personalized coaching report. Free to start.