For now, running the following script in node / chrome:
setTimeout(() => console.log("setTimeout callback"), 0); Promise.resolve().then(() => console.log("Promise callback"));
Gives me the following result (in order):
- Promise callback
- setTimeout callback
The information I'm taking from this is:
- All of the microtasks are executed right before the next task in the loop.
My problem is: from Jake Archibald, a great software engineer working on different specs, in his article dealing with microtasks and the event loop explains that:
Can anybody highlight me with this?