Skip to main content

Practice ยท 1 of 2

Execution Order Probe

CHALLENGE
Difficulty: intermediate+25 XP

Write runProbe(log) โ€” log is a function that records strings. WITHOUT calling log directly except inside the callbacks, schedule exactly this sequence using log: 1. synchronously: log("sync") 2. a microtask: log("micro") (use Promise.resolve().then) 3. a macrotask: log("macro") (use setTimeout with 0) The probe function itself must return the string "scheduled" immediately, and all three logs must have happened by the time the test awaits one 20ms timeout.

Back to lesson: Practice: Event Loop โ€” Practice