JavaScript·Intermediate·Conceptual·1 min read
Why does setTimeout(fn, 0) not run immediately?
Short interview answer
It schedules a task after the minimum delay has elapsed. The callback still waits for the current task, all pending microtasks, and earlier eligible tasks. Browsers may also clamp nested or background timers.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.