# Promise

**Date:** 2025-11-28  
**Tags:** JavaScript, Async, WebDev  
**URL:** https://kelexine.is-a.dev/til/js-promise-allsettled

---

TIL: Promise.allSettled() waits for all promises regardless of rejection. Unlike Promise.all() which fails fast. Perfect for batch operations where you need all results, even failures. Great for API retries.


```javascript
const results = await Promise.allSettled([
  fetch('/api/1'),
  fetch('/api/2'),
  fetch('/api/3')
]);

// Check each result
results.forEach(r => {
  if (r.status === 'fulfilled') console.log(r.value);
  else console.error(r.reason);
});
```



**Related:** [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled)


---

*This content is available at [kelexine.is-a.dev/til/js-promise-allsettled](https://kelexine.is-a.dev/til/js-promise-allsettled)*
