r/javascript • • May 28 '19

What are some JavaScript things beginners don't know?

333 Upvotes

383 comments sorted by

View all comments

Show parent comments

2

u/justrhysism May 29 '19

I believe this would wait for each promise to resolve before moving onto the next loop.

The Promise.all() solution allows each async call to happen async concurrently; only moving on once all promises resolve (regardless of the order in which they resolve).

0

u/[deleted] May 29 '19

[deleted]

2

u/justrhysism May 29 '19

In that case doSomethingWhenDone() could execute before the promises inside the loop have resolved.