DEV Community

Discussion on: How to use async/await inside loops in JavaScript

Collapse
 
shadid12 profile image
Shadid Haque

Thank you @z2lai interesting point. I will make a follow up post on this one

Collapse
 
z2lai profile image
z2lai • Edited

I forgot to mention that using a counter variable in my example to determine when all promises have been resolved is actually a replacement for Promise.all() (it might even be that this is how Promise.all() is implemented under the hood).

This approach is very well explained in YDKJS's section on "Interaction" in the Asynchrony chapter. I recommend people to go through that entire section: github.com/getify/You-Dont-Know-JS...