---
title: "JavaScript Interview Questions (2026): By Level, With Model Answers"
url: https://weworkworldwide.com/javascript-developer-interview-questions/
description: "JavaScript interview questions for junior, mid and senior developers — closures, the event loop, prototypes and async — with model answers and red flags."
date: 2026-07-04T15:28:59+00:00
source: https://weworkworldwide.com/llms.txt
---

# JavaScript Interview Questions (2026): By Level, With Model Answers

How to use this

JavaScript is forgiving enough that people ship it for years without understanding closures, `this`, or the event loop. These questions surface who actually knows the language.

Hiring a JavaScript developer is easy. Telling a real one from a convincing résumé is the hard part — and it’s most of what we do. These are grouped by level, because the same question that stretches a junior is a warm-up for a senior.

## Junior JavaScript interview questions

0–2 years

Core language mechanics.

### What is the difference between `let`, `const` and `var`?

What a strong answer covers

`var` is function-scoped and hoisted; `let`/`const` are block-scoped with a temporal dead zone, and `const` forbids reassignment (though objects it points to stay mutable).

Red flag

Thinks `const` makes an object immutable, or uses `var` with no idea why it’s discouraged.

### What is the difference between `==` and `===`?

What a strong answer covers

`===` compares without type coercion; `==` coerces types first, which produces surprising results. A good answer defaults to `===`.

Red flag

Uses `==` everywhere and can’t explain coercion pitfalls.

### What are truthy and falsy values?

What a strong answer covers

Falsy values are `false`, `0`, `""`, `null`, `undefined`, `NaN`; everything else is truthy, including `[]` and `{}`.

Red flag

Thinks empty array or object is falsy.

### What is a closure?

What a strong answer covers

A function that retains access to variables from the scope it was created in, even after that scope has returned; the basis for data privacy and callbacks.

Red flag

Can use closures accidentally but cannot define or explain one.

### What’s the difference between `null` and `undefined`?

What a strong answer covers

`undefined` means a variable has been declared but not assigned; `null` is an explicit “no value.” They know `typeof null` is the historical `"object"`.

Red flag

Treats them as interchangeable with no nuance.

### How does `this` work?

What a strong answer covers

It is determined by how a function is called: the object before the dot, the global/undefined in plain calls, bound explicitly with `call`/`apply`/`bind`, and lexically in arrow functions.

Red flag

Believes `this` is fixed at definition time for normal functions.

### What is the difference between `map`, `forEach` and `filter`?

What a strong answer covers

`map` returns a new transformed array, `filter` returns a subset, `forEach` returns nothing and is for side effects.

Red flag

Uses `map` for side effects and ignores the returned array.

### What does `JSON.parse`/`JSON.stringify` do, and its limits?

What a strong answer covers

Serialise to and from JSON text; limits include losing functions, `undefined`, and `Date` becoming a string, plus failing on circular references.

Red flag

Unaware that dates and undefined don’t round-trip.

## Mid-level JavaScript interview questions

2–5 years

Async model and prototypes.

### Explain the event loop, call stack and task queues.

What a strong answer covers

Synchronous code runs on the call stack; async callbacks are queued and run when the stack clears, with microtasks (promises) draining before macrotasks (timers). They can predict logging order.

Red flag

Cannot explain why a promise resolves before a `setTimeout(0)`.

### What is the difference between promises and async/await?

What a strong answer covers

`async/await` is syntactic sugar over promises that reads synchronously; errors are caught with `try/catch` instead of `.catch()`. They know `await` only pauses the async function, not the whole program.

Red flag

Thinks `await` blocks the entire thread.

### How do you run async operations in parallel?

What a strong answer covers

`Promise.all` for all-or-nothing, `Promise.allSettled` when you need every result regardless of failures; awaiting in a loop serialises them unnecessarily.

Red flag

Awaits independent calls sequentially in a `for` loop.

### What is prototypal inheritance?

What a strong answer covers

Objects delegate to a prototype via the prototype chain; property lookups walk that chain, and `class` is sugar over it.

Red flag

Thinks JS classes are like Java classes with no prototype underneath.

### What are `call`, `apply` and `bind`?

What a strong answer covers

All set `this`; `call`/`apply` invoke immediately (args list vs array), `bind` returns a new bound function.

Red flag

Cannot say how they differ.

### What is debouncing vs throttling?

What a strong answer covers

Debounce delays until activity stops (e.g. search input); throttle caps the rate (e.g. scroll handlers). They match the technique to the use case.

Red flag

Uses the terms interchangeably.

### What are common causes of memory leaks in JS?

What a strong answer covers

Forgotten timers and listeners, closures holding large objects, detached DOM nodes, and unbounded caches or global variables.

Red flag

Thinks the garbage collector makes leaks impossible.

### What does `&&`, `||` and `??` return?

What a strong answer covers

They return one of their operands, not a boolean; `??` only falls back on `null`/`undefined`, unlike `||` which falls back on any falsy value.

Red flag

Assumes `||` and `??` behave identically.

## Senior JavaScript interview questions

5+ years

Performance, patterns and deep semantics.

### How do you optimise the performance of a JS-heavy page?

What a strong answer covers

Reduce main-thread work, split and lazy-load bundles, avoid layout thrash, debounce expensive handlers, and move heavy computation to Web Workers — after profiling.

Red flag

Optimises by intuition without measuring in DevTools.

### What is the module system story in JS?

What a strong answer covers

ES modules are static and tree-shakeable with live bindings; CommonJS is dynamic and synchronous. They understand bundling and interop concerns.

Red flag

No grasp of the difference or why bundlers exist.

### How does garbage collection work in V8?

What a strong answer covers

A generational, mark-and-sweep collector; short-lived objects are collected cheaply in the young generation. They avoid retaining references unnecessarily.

Red flag

Believes setting a variable to null forces immediate collection.

### When and why would you use a Web Worker?

What a strong answer covers

To move CPU-bound work off the main thread and keep the UI responsive, communicating via message passing since there is no shared DOM access.

Red flag

Tries to touch the DOM from a worker.

### What are generators and where are they useful?

What a strong answer covers

Functions that can pause and resume with `yield`, useful for lazy sequences, custom iterators and controlled async flows.

Red flag

Never encountered them and can’t reason about lazy iteration.

### How do you handle errors in async code robustly?

What a strong answer covers

`try/catch` around awaits, handling rejected promises, a global `unhandledrejection` handler, and never swallowing errors silently.

Red flag

Lets promise rejections go unhandled.

### What is the difference between shallow and deep copying?

What a strong answer covers

A shallow copy (spread, `Object.assign`) copies top-level references; nested objects are shared. Deep copies need `structuredClone` or a recursive approach.

Red flag

Spreads an object and is surprised nested mutations leak.

### How do you keep a large JS codebase maintainable without a framework?

What a strong answer covers

Clear module boundaries, pure functions, consistent state management, TypeScript or JSDoc types, and tests. They think in architecture, not files.

Red flag

Relies on global state and huge files.

**Skip the screening entirely.**We vet JavaScript engineers so you don’t have to — embed one in your team, or have us build it.

[Hire JavaScript developers](https://weworkworldwide.com/outstaffing/)[Compare us](https://weworkworldwide.com/compare/)

Build and score a full interview with our free [interview scorecard tool](https://weworkworldwide.com/developer-interview-scorecard/), browse the [full question hub](https://weworkworldwide.com/interview-questions/), or see [how we interview engineers](https://weworkworldwide.com/how-we-interview-engineers/).
