4 ms·
How do you account for the behavior of Promise.all? Or do you mean parallel?
by mpalmer 3y ago
How do you account for the behavior of Promise.all? Or do you mean parallel?
- chpatrick 3y agoPromise.all is just a for loop that awaits all the promises. They still don't run concurrently. The way JS works is that some event happens, which can cause some handler to run. When it's finished, the next event handler runs. But no two pieces of code execute at the same time in the same context.
- jemmyw 3y agoThey don't run any js code concurrently. They'll call into native code that does run concurrently, or at least concurrent io, but when it gets back to your js code it is all synchronous.