The Secret Life of JavaScript: The Promise (Microtasks)
SMRTR summary
JavaScript's event loop operates with two queues: microtasks (Promises, queueMicrotask) get VIP priority over macrotasks (setTimeout, setInterval). When code execution finishes, the engine always processes all microtasks before any macrotasks, explaining why Promise.resolve().then() executes before setTimeout(..., 0). This priority system can cause browser freezing if microtasks continuously spawn new microtasks.
SMRTR provides this summary for quick context. The original article belongs to Dev.to.
Read the original article