Event Loop Visualizer

This model shows a simplified JavaScript runtime: stack-first execution, then microtasks, then tasks. Use the examples to see why Promise.then callbacks run before setTimeout(..., 0) callbacks.

Shows stack-first execution with no queued async work.

  • Synchronous statements run immediately in order.
  • The call stack must clear before the loop checks queues.

Controls

Playback speed

Tick: 0

Executing global() on the sync queue.

Call stack

Top frame is the currently executing function/context.

  1. global()

    source: sync • next op 1/3 active

Microtask queue

Promise callbacks and async continuations.

  1. No microtasks queued.

Task queue

Macrotasks like timeout callbacks.

  1. No tasks queued.

Timers

Waiting for their due tick before entering task queue.

  1. No pending timers.

Execution timeline

Ordered log of what happened and why.

  1. t0Script start

    Started example: Simple synchronous flow

Subscribe via RSS

Copyright © 2020 - 2026 Alex Leung