setTimeout callbacks, user interaction events and scripts are macro tasks (or just tasks). When scheduled, they are added to a queue and are executed one by one (one per event loop cycle).
setTimeout callbacks, user interaction events and scripts are macro tasks (or just tasks). When scheduled, they are added to a queue and are executed one by one (one per event loop cycle).
And now itโs riddle time! What will the following code print and when will the DOM change be actually painted to the screen?
Bonus question: what will change (if anything at all) if you resolve the promise in 30ms instead of 10ms?