• Js is a non-blocking single thread
  • Execution stack: All synchronization tasks are executed on the main thread, and when executed, tasks are successively removed from the task queue to be executed. This process is called an eventloop
  • Macro and micro tasks: Promises(native Promises implemented by browsers), MutationObserver, Process. nextTick, Macro task Note that script, which is the synchronized code that starts out on the main execution stack, is also essentially a MacroTask, which is the first task to execute
  • Execution stack, heap, task queue Execution stack: first in, last out, store Pointers to basic data types and reference data. Heap: Store reference data types. Task queue: store asynchronous tasks, first in, first out
  • New Promise(FN) fn is synchronizing process.nexttick > promise. then>setTimeout>setImmediate SetImmediate When there are multiple setImmediate loops through the execution