Even setTimeout(fn, 0) doesn't run immediately. It schedules the callback for the next event loop iteration.
console.log("First");
setTimeout(() => console.log("Third"), 0);
console.log("Second");
// Output: First, Second, Third
This defers work until after current synchronous code completes.