How to return many Promises in a loop and wait for them all to do other stuff

questionsCategory: QuestionsHow to return many Promises in a loop and wait for them all to do other stuff
sandy asked 1 year ago

I have a loop which call a method that do stuff asynchornously. This loop can call the method many time. After this loop I have another loop that need to be execute only when all the asynchronous stuff is done. So this illustrate my wants :

for(i=0;i<5;i++){
    doSomeAsyncStuff();    
}

for(i=0;i<5;i++){
    doSomeStuffOnlyWhenTheAsyncStuffIsFinish();    
}