1. Many articles have talked about how eventloop runs, how to read task queues, macro tasks, micro tasks, and so on, but I don"t quite understand when the first tick? started
.
Macro tasks: script overall code, setTimeout, etc.
Micro tasks: promise, etc.
< H2 > when does it start? < / H2 >
statement 1: even if you start a tick when executing global script code
statement 2: when you start reading asynchronous tasks from the task queue after all the Synchronize code is executed, you start tick, for the first time. This asynchronous task may be micro-tasks such as promise
.
< H2 > when does it end? < / H2 >
statement 1: if there is a micro task, then every time the micro task is executed, the tick ends, that is, the macro task-micro task. If there is no micro task in the tick, the execution of the macro task is over.
< H2 > all the above statements are that my own guesses may not be accurate. I hope the boss will answer the questions. < / H2 >