As far as I understand async/await, I would expect the following code to print a
and then b
, but it does print b
first. Why doesnt await
force it to wait for the execution of the first Timeout?
(async () => {
await setTimeout(()=>console.log("a"),10);
await setTimeout(()=>console.log("b"),0);
})();