Understanding of macro tasks and micro tasks

Concept:
- Macro tasks: common timers, user interaction events, etc. ([Turtle's butt] These are macro tasks)
- Micro tasks: Promise related tasks, MutationObserver, etc. (same, just a name!!!)

The first principle:
asynchronous execution starts after the synchronous code finishes running.
The second principle:
microtasks at the same level are always executed before macrotasks.
The third principle:
each macrotask is associated with a separate microtask queue

Guess you like

Origin blog.csdn.net/weixin_44063225/article/details/125634269