Hi Christopher. It happens due to:

“You can see how timeout finished is written at the end, because the script itself is treated as a macrotask so that at the end the enqueued microtasks are executed, that is, the two console.log referring to the callbacks of the promises.”

So the script itself is a macrotask (with the Promises as its microtasks) and the setTimeout other different macrotask.

I hope I solve your question :)

Entre paseo y paseo con Simba desarrollo en Symfony y React

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store