3 ms·
I think the main concerns is that the following code happens in the expected order. console.log("First"); promise.then(_ => console.log("Third")); console.lo
by kevincox 9y ago
I think the main concerns is that the following code happens in the expected order.
console.log("First");
promise.then(_ => console.log("Third"));
console.log("Second");
This means that even if `promise` is fulfilled already the callback must be delayed at least until the next turn of the event loop.
- skybrian 9y agoYes, it does need to be delayed until the stack is unwound, but it doesn't need to be delayed until after any events already on the main event queue. (I'm not sure what "the next turn of the event loop" means in the presence of multiple queues.)