#15MediumJavaScript functions
15. Promise.any Polyfill
JavaScriptAsync & Promises
Implement promiseAny(iterable) that resolves as soon as any promise fulfills, or rejects with an AggregateError if all reject.
Example 1:
await promiseAny([Promise.reject("err"), Promise.resolve(42)]); // 42solution.js
Resolves with the first fulfilled value
(async () => {
const res = await promiseAny([Promise.reject("fail"), Promise.resolve(99)]);
expect(res).toBe(99);
})()