JavaScript Runtime Visualizer

EventLoop Lab

Analyze small JavaScript snippets and step through how supported patterns move through the call stack, Web APIs, microtask queue, macrotask queue, and event loop.

Code sample

Shows why promise microtasks run before timer macrotasks, even when setTimeout uses 0ms.

Current line: 1

Parser v1 supports simple console.log, function calls, setTimeout, and Promise.resolve().then examples. Unsupported code is ignored for now.

Trace is up to date.

Analyzed code

Execution timeline

Step 1 of 6

Sync

Run console.log("A")

This console.log runs synchronously on the call stack and executes immediately.

Runtime events

  1. 1.Push console.log("A") onto the call stack
  2. 2.Print A to console
  3. 3.Pop console.log("A") from the call stack

Call stack

global()
console.log("A")

Web APIs

No browser API work.

Microtask queue

No microtasks queued.

Macrotask queue

No macrotasks queued.

Console output

> A