A JavaScript event-loop ordering challenge. Fourteen scenarios schedule work with
promises, setTimeout, queueMicrotask, async/await, thenables, rejections,
process.nextTick, requestAnimationFrame, and MessageChannel — your job is to
predict the exact order the logs fire, before running anything.
There are two ways to play: a React web app with live grading and a queue
visualizer, or a Node game driven by the Vitest suite. The full challenge guide
lives in src/exercises/event-loop-order/README.md.
- Node v24.18.0 — pinned in
.nvmrc - pnpm 11.20.0 — pinned via the
packageManagerfield inpackage.json
From the repository root:
# 1. Use the pinned Node version
nvm use
# 2. Activate the pinned pnpm version (via Corepack, bundled with Node)
corepack enable
# 3. Install dependencies
pnpm install
# 4. Start the dev server
pnpm devThen open the URL Vite prints (by default http://localhost:5173). Pick a scenario, click the labels into your predicted order, and hit Run & grade. Progress is saved in localStorage.
To build and serve a production bundle instead:
pnpm build
pnpm previewWrite your predicted orders in
src/exercises/event-loop-order/predictions.ts,
then let the tests grade you:
pnpm test # run the suite once
pnpm test:watch # re-grade on every save| Command | What it does |
|---|---|
pnpm dev |
Start the Vite dev server for the web app |
pnpm build |
Build the production bundle to dist/ |
pnpm preview |
Serve the production bundle locally |
pnpm test |
Run the Vitest suite once |
pnpm test:watch |
Run Vitest in watch mode |
pnpm test:coverage |
Run tests with V8 coverage (reports to coverage/) |
pnpm typecheck |
Type-check with tsc --noEmit |
pnpm reveal:event-loop |
Print every scenario's actual order (spoilers) |