Promise Patterns

Common JavaScript promise patterns and async/await usage

1 min read |108 words
March 12, 2026

Promise.all

Run multiple promises in parallel:

const [users, posts] = await Promise.all([
  fetch('/api/users').then(r => r.json()),
  fetch('/api/posts').then(r => r.json()),
])

Promise.allSettled

Wait for all promises regardless of outcome:

const results = await Promise.allSettled([
  fetch('/api/fast'),
  fetch('/api/slow'),
  fetch('/api/failing'),
])

const successful = results
  .filter(r => r.status === 'fulfilled')
  .map(r => r.value)