What does this print?
log("A");setTimeout(() => log("B"), 0);Promise.resolve().then(() => log("C"));log("D");What this Node.js test measures, in short
This test checks whether you can predict what Node.js does at runtime: the order of timers, immediates, nextTick and promises, how CommonJS and ES modules load, what happens to async errors, and how buffers, streams and events behave.
Snippets assume Node 20 or later, CommonJS unless marked, with log as console.log. Frameworks like Express aren't covered. The questions are our own and not standardised, so treat the result as a knowledge check, not a certification.
By What's Your IQ · Reviewed 4 Oct 2026- Format
- 15 predict-the-output questions, 4 options each
- Topics
- Event loop, modules, async and errors, buffers and streams, events and process
- Assumes
- Comfortable JavaScript, including promises
- Runtime
- Created by Ryan Dahl; first released 2009
Four queues, one predictable order
This runs inside an I/O callback, where the order is guaranteed. (At the top level of a script, timeout vs immediate can go either way.) Step through to watch each queue fill and drain.
Works on your laptop, stalls in production
app.get("/report", (req, res) => { const data = fs.readFileSync("big.csv"); res.send(summarise(data));});import { readFile } from "node:fs/promises";app.get("/report", async (req, res) => { const data = await readFile("big.csv"); res.send(summarise(data));});readFileSync blocks the only thread, so every other request waits while one file loads. The promise version lets the loop serve others meanwhile.
- Dahl, R. (2009). Node.js. Talk at JSConf EU, Berlin.
- OpenJS Foundation. About Node.js and release notes. nodejs.org.
- Dahl, R. (2018). 10 things I regret about Node.js. JSConf EU.