JavaScript
Async & promises cheat sheet
Promise combinators, async iteration, cancellation with AbortController and the timing helpers that avoid unhandled rejections in asynchronous JavaScript.
Combinators
Cancellation
Errors
Timing
Iteration
Things worth remembering
- Promise.all rejects on the first failure. Use allSettled when you want every result regardless.
- An async function always returns a promise, so returning a promise inside it does not double-wrap.
- AbortSignal.timeout(ms) gives you fetch timeouts without a manual setTimeout.