The examples

In curriculum order — each one asks for your prediction first, then animates exactly why. Warm-ups build the model, core examples are the interview classics, advanced ones break the loop on purpose.

  1. Fig. 1warm-up

    One thing at a time

    No async at all — how the stack really runs your code.

    7 steps · predict first →

  2. Fig. 2warm-up

    setTimeout(0), alone

    Zero milliseconds does not mean now.

    7 steps · predict first →

  3. Fig. 3warm-up

    A promise, alone

    Even an already-resolved promise waits its turn.

    6 steps · predict first →

  4. Fig. 4core

    Promise vs setTimeout

    The classic showdown — and the classic interview question.

    9 steps · predict first →

  5. Fig. 5core

    .then after .then

    Each link in a .then chain is its own microtask.

    7 steps · predict first →

  6. Fig. 6core

    async/await, unmasked

    Watch a function leave the stack mid-body.

    7 steps · predict first →

  7. Fig. 7advanced

    Starving the loop

    VIPs forever — the timer never eats.

    8 steps · predict first →

  8. Fig. 8advanced

    Blocking the loop

    One hot loop freezes the whole page.

    6 steps · predict first →