Promise.any() method is similar to Promise.race() method. It takes an array of promises as an input and returns a single promise.
The only difference is that the
Promise.race() method will reject the flow if any of the promises fail but
Promise.any() stores the first resolved promise regardless of other promises that have failed.
In the above code, we make three promises and make demo functions to return the result with setTimeout() function.
Then we passed the array of promises to any() method and return the single result with the first resolved promise.