Canva Interview Question

How would you allow for multiple promises to be processed at the same time?

Interview Answers

Anonymous

Jun 17, 2020

Promise.all()

1

Anonymous

Oct 18, 2020

Actually Promise.all is not the only one, just depend on what you need, if your promises need to execute with a depedency grade, so Promise.all will work fine, but if you just want to execute all of them, so you should use Promise.allSettled , so will return a promise when all the passed promises were resolved or rejected, so Promise.all will stop de execution if any of the promise failed.

Anonymous

Nov 17, 2022

Promise.all() good for getting results in parallel - doesn't complete till all promises complete the other way to do is is through for( const x of y) {...} or x.foreach(y...) or even x.reduce(y...), which will exec in series