Home › Blog › JavaScript interview questions

JavaScript interview questions

JavaScript interviews return to the same handful of topics because they are the ones where the language behaves differently from what people assume. Expect at least one question whose answer is a specific order of console output.

The event loop, which is near-guaranteed

You will be shown code mixing `setTimeout`, promises and synchronous logging and asked for the output order. The model to hold: all synchronous code runs first, then the microtask queue drains completely (promise callbacks), then one macrotask runs (timers), and the cycle repeats.

Closures and scope

Say the mechanism, not the label. "The callback keeps a reference to the variable, not a copy of its value" is worth more than naming it a closure.

this, prototypes and objects

Practical questions

Expect at least one small implementation: flatten a nested array, implement `Array.prototype.map`, write a function that retries a promise, or build a simple event emitter. These are closer to the job than trivia and are increasingly how front-end loops are run - the component-building round is covered in frontend interview questions.

How deep it goes by level

Whatever the level, the reliable way to prepare is to say your answers out loud rather than reading them. Most of what candidates lose in a JavaScript interview is lost in the gap between knowing something and explaining it under observation - the method is in how to use AI for interview prep.

Where CoPilot Interview fits

Disclosure: we build an interview assistant, so treat this as a disclosed pitch. CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds, with a permanent free tier that needs no credit card.

Frequently asked questions

What are the most common JavaScript interview questions?

Closures, the event loop and output ordering with setTimeout and promises, `this` binding across function types, prototypal inheritance, and implementing debounce or throttle from scratch. An output-order question is close to guaranteed.

How do you explain the event loop in an interview?

Synchronous code runs first, then the microtask queue drains completely - promise callbacks - then a single macrotask such as a timer runs, and the cycle repeats. That model answers almost every output-ordering question you will be given.

What is the difference between a normal function and an arrow function?

Arrow functions do not have their own `this`; they inherit it from the enclosing lexical scope. That is why arrow functions are convenient in callbacks and wrong as object methods when you need `this` to refer to the object.

Do JavaScript interviews still ask about prototypes?

Yes, though usually framed through `class` syntax - what it desugars to, and how inheritance resolves through the prototype chain. You rarely need to write prototype manipulation by hand any more.

Walk into the round with a second pair of eyes

CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds. The free tier is permanent: 15 minutes a day, no credit card.

Try it free