All 15

See how JavaScript actually runs.

Predict the console output, then trace callbacks, scopes and bindings step by step — Call Stack, queues, and the environments your closures capture.

interview.jsrunning
1console.log('A');
3setTimeout(() => console.log('B'), 0);
5Promise.resolve().then(() => console.log('C'));
7console.log('D');
Microtask Queue0
empty
Task Queue0
empty
Console
>A
>
>
>
Sync code runs first

15 cases · 19 experiments · outputs verified on every commit

The series

15 snippets developers get wrong — each one naming the exact misconception when you do.

Async JavaScript

Microtasks, chains, await, and the network.

START HERE ~8 min

How Promises Run

Promise vs setTimeout

The classic interview question. setTimeout is registered BEFORE the promise — so why does the promise callback run first? Watch the two queues to find out.

22 steps Start →
Intermediate ~8 min

How Promise Chains Run

Two chains, interleaved

Two promise chains, written one after the other. They do not run one after the other — they interleave, step for step. The reason is a single rule about when a chained .then() is queued.

29 steps Start →
Intermediate ~7 min

How queueMicrotask Runs

queueMicrotask vs Promise.then

queueMicrotask vs Promise.then vs setTimeout(0): one shared microtask queue, strict FIFO between them, and what recursive microtasks starve. Watch it run step by step.

29 steps Start →
Advanced ~8 min

How await Runs

async / await

async/await is syntactic sugar over promises. See the exact moment main() suspends, where its continuation waits, and why the global script keeps running.

19 steps Start →
Intermediate ~8 min

How Rejections Run

throw · catch · finally

Nine cases in, everything so far has succeeded. This one throws. Where does the error go, when does catch actually run — and what happens if nobody catches at all?

19 steps Start →
Intermediate ~8 min

How Promise.all Runs

fail-fast, but nothing gets cancelled

Promise.all rejects the moment one input rejects. So what happens to the other promises — do they stop? Watch the slow timer to find out.

23 steps Start →
Intermediate ~9 min

How fetch Runs

await over the network

A request takes 200ms and JavaScript is single-threaded. So what is the thread doing meanwhile, why are there TWO awaits, and why does a 404 sail straight past your catch block?

28 steps Start →

How It Runs is an interactive course on the JavaScript runtime: the event loop, the call stack, microtasks and task queues, promises, async/await, timers, and how Node.js orders process.nextTick and setImmediate. Every case starts with a prediction — you commit to an output before watching the execution trace play out step by step — because the wrong guesses are where the learning is.

Start with how the event loop runs, test yourself with the daily JavaScript quiz, keep the event loop cheatsheet open while you code, or look a term up in the runtime glossary. The scoping side has cases too: the temporal dead zone and Promise.all's fail-fast behaviour are two favourites.

Every output here is executed, not asserted.

A script runs each snippet for real on every build and checks the real output against the trace's final console state and the answer key. If they disagree, the build fails.

How this is verified →