JavaScript Interview Questions 2026

JavaScript interviews at FAANG test deep language knowledge, not just framework familiarity. Closures, the event loop, and async patterns are tested directly.

Quick Answer

JavaScript front-end interviews test: the event loop (call stack, microtask queue, macrotask queue), closures and lexical scope, prototype chain, async/await and Promise internals, and this binding rules. For general FAANG coding rounds, most candidates use Python or Java, but JavaScript is required for front-end SWE and full-stack roles.

Closures and Scope

A closure is a function that retains access to its outer scope even after the outer function has returned. Classic interview question: what does the following log? for(var i=0;i<3;i++){setTimeout(()=>console.log(i),0)}. Answer: 3, 3, 3. Fix with let or an IIFE.

Common closure question: implement a counter() function that returns an object with increment, decrement, and value methods. The counter value should be private. This tests whether you understand closure-based encapsulation.

The Event Loop

JavaScript is single-threaded. The event loop processes the call stack, then the microtask queue (Promises, queueMicrotask), then the macrotask queue (setTimeout, setInterval, I/O). Microtasks always drain before the next macrotask.

Interview question: what order do these execute? setTimeout(()=>console.log('macro'),0) then Promise.resolve().then(()=>console.log('micro')). Answer: micro first, then macro. Understanding this order is fundamental to async JavaScript debugging.

Promises and async/await

Promise.all runs in parallel and rejects if any promise rejects. Promise.allSettled waits for all to settle regardless of rejection. Promise.race resolves/rejects with the first settled promise. Promise.any resolves with the first fulfilled promise.

Implement a function that retries a promise-returning function up to N times with delay. This is a direct interview prompt. Know how to chain .then() in a loop vs using async/await with a for loop.

Prototype Chain and this

Every object has a [[Prototype]] internal slot pointing to its prototype. Property lookup traverses the chain until it finds the property or reaches null. Object.create(proto) creates an object with a specific prototype.

this binding: in a regular function, this is the caller. In an arrow function, this is lexically bound to the enclosing context. Common mistake: using a regular function as a callback in a class method loses this. Fix with arrow function or .bind(this).

Browse Frontend and Full-Stack Questions

Real frontend and SWE questions from top tech companies.

Browse Meta SWE Questions