What is Promise in JavaScript? Diffrenec between Promise.race vs Promise.any?
The Promise.race() method returns a promise that fulfills or rejects as soon as one of the promises in an iterable fulfills or rejects, with the value or reason from that promise.
Promise.any() takes an iterable of Promise objects and, as soon as one of the promises in the iterable fulfills, returns a single promise that resolves with the value from that promise. If no promises in the iterable fulfill , then the returned promise is rejected with an AggregateError.
Promise. race is settled as soon as any of the promises you feed it settle, whether they are fulfilled or rejected. Promise. any is settled as soon as any of the promises you feed it is fulfilled or they are all rejected, in which case it’s rejected with an AggregateError .