Namaste JavaScript — Interview Quick Notes
Ep 17: setTimeout Trust Issues
- setTimeout(cb, 0) does not run immediately — cb still goes through the Callback Queue and waits for the Call Stack to be empty.
- Concurrency model: if the Call Stack is busy for 10s and the timer was 5s, the callback fires after 10s — not 5s.
- setTimeout guarantees at least the specified delay, never exactly.