DEV Community

Discussion on: About async functions

 
mike4040 profile image
Mike Kravtsov

Or .reduce, starting with Promise.resolve().
The issue is not complicated, easy to find a few good solutions on StackOverflow.

Thread Thread
 
miketalbot profile image
Mike Talbot ⭐ • Edited

Worth just pointing out that for...of and reduce cause the promises to be started in sequence where the all variants start them without waiting for the earlier ones to finish.

My 2 cents: for...of lets you chain promises and terminate early, that's my way to go if that's my need or if the reduce function would be long, as I find that more readable in this circumstance.