Course lesson
Manage Asynchronous JavaScript code with any, allSettled new Promise Methods
Promise.any takes an iterable of promises and returns a promise that fulfills with the first promise that fulfills, and rejects when ALL of the promises in the iterable reject.
- Duration
- 5 min
- Access
- Free
- Transcript
- Retained from source evidence
Promise.any takes an iterable of promises and returns a promise that fulfills with the first promise that fulfills, and rejects when ALL of the promises in the iterable reject.
Promise.allSettled takes an iterable of promises, and returns an array of objects. The objects have a status property which is a string that is either "fulfilled" or "rejected". If the status is "fulfilled" the object will contain a value property with the resolved value of the promise, and if the status is "rejected" the object will have a reason property with the reason for the promise's rejection.