Handling multiple Promises in Javascript - [all, allSettled, any, race]
Barely Coding with Daniel Bark
I created a hello world app for exploring four functions available on promise: all, allSettled, any, race. The code for this tutorial can be found here: https://github.com/danba340/promises-hello-world
All four of these functions takes in a list of promises and returns one promise. All and allSettled are for handling multiple promise results. All expects all promises to be fulfilled and allSettled allows promises to be both fulfilled and rejected. Any and race are for handling just one of the promises. Race will just take the first one that has a result even if it was a reject. Any will wait for the first fulfilled promise.
Say hi on Twitter: Twitter: https://twitter.com/barelydaniel ... https://www.youtube.com/watch?v=-mEYlx2w00A
37045940 Bytes