What is the JavaScript rule that determines the output of this code?:
Promise.resolve()
.then(() => console.log("Microtask 1"))
.then(() => console.log("Microtask 11"));
Promise.resolve()
.then(() => console.log("Microtask 2"))
.then(() => console.log("Microtask 22"))
This is the output:
Microtask 1
Microtask 2
Microtask 11
Microtask 22
But why isn't this the output?:
Microtask 1
Microtask 11
Microtask 2
Microtask 22