Intuition
The browser as a single cashier
Imagine a tiny store with one cashier. Customers line up in different ways: some are standing in the main line, some leave sticky notes that must be handled right after the current customer, and the cashier also has to occasionally tidy the store window so it looks updated.
The browser works like that too. It handles JavaScript one thing at a time, then checks for urgent follow-up work, and only then gets a chance to render what changed on the page. That’s why a small piece of code can still affect when a page updates, and why some callbacks seem to run "before" others even if they were scheduled earlier.