← Back to blog

JavaScript interview questions and answers

JavaScript interview questions and answers — cover from Greenroom, the AI mock interviewer

JavaScript powers every frontend role and a huge share of backend ones, and its interviews reward understanding the language's quirky core: closures, this, asynchronous behavior, and the event loop. These few concepts come up again and again. Here are the JavaScript interview questions that actually get asked, with answers. (For frontend-specific topics, see our frontend interview guide.)

Core JavaScript

Asynchronous JavaScript

JavaScript interview topics — closures, hoisting, this, async, event loop
JS rounds live and die on closures, 'this', and the event loop — know them cold.

Functions & objects

The core truth: JavaScript interviews hinge on a handful of deep concepts — closures, this, and the event loop. Candidates who truly understand asynchronous execution stand out instantly, because most people only memorize the syntax of async/await without grasping what's happening underneath.

How to prepare

Output-prediction and "explain what this does" questions are common, so practise narrating code behavior out loud. Greenroom runs spoken technical interviews that follow up on your reasoning and give feedback on clarity. Pair it with our frontend and React guides.

Frequently asked questions

What are the most common JavaScript interview questions?

Common JavaScript questions cover var/let/const and hoisting, == vs === and coercion, closures, how 'this' works with call/apply/bind, the event loop and microtask queue, callbacks vs promises vs async/await, prototypal inheritance, arrow vs regular functions, and debouncing vs throttling. Closures, 'this' and asynchronous behavior are the highest-yield topics.

What is a closure in JavaScript?

A closure is a function that retains access to variables from its outer (enclosing) scope even after that outer function has finished executing. Closures are how JavaScript implements data privacy and stateful functions — for example a counter function that keeps a private count variable that only its returned inner function can read and update.

How does the JavaScript event loop work?

JavaScript runs on a single thread with a call stack. Asynchronous callbacks wait in queues — the microtask queue (promises) and the macrotask queue (timers, I/O). The event loop continuously checks whether the call stack is empty, then pushes queued callbacks onto it, processing all microtasks before the next macrotask. This is how single-threaded JS handles concurrency.

How should I prepare for a JavaScript interview?

Focus on the deep core concepts — closures, 'this' binding, prototypal inheritance and especially the event loop and async/await — rather than just syntax, since these separate strong candidates. Practise narrating code behavior and output predictions out loud, ideally with a voice-based mock interview, because these rounds are often live and verbal.

JS interviews hinge on closures, 'this', and the event loop — explained out loud. Greenroom runs spoken technical interviews with feedback on your reasoning. Free to start.