The Fetch API provides a JavaScript interface for making HTTP requests across the network, returning Promises that resolve to Response objects.
Reference
Async APIs
Promise-based APIs and async patterns.
- fetch()
- Promise
The Promise object represents async results, available now, later, or never. Covers creation, chaining, and all six static combinator methods.
- Promise.all()
Promise.all() waits for every promise in an iterable to resolve, returning results in input order. Fails fast on first rejection — use when all must succeed.
- Promise.allSettled()
Promise.allSettled() waits for all promises to settle, returning results for fulfilled and rejected outcomes without short-circuiting on the first failure.
- Promise.any()
Promise.any() takes an iterable of promises and resolves with the first success, or rejects with an AggregateError if all input promises reject.
- Promise.prototype.catch()
Promise.prototype.catch() attaches a rejection handler to a Promise and returns a new Promise, letting you recover from errors or re-throw them in a chain.
- Promise.prototype.finally()
Promise.prototype.finally() runs a callback when a Promise settles. Ideal for cleanup: hiding spinners, closing connections, resetting flags.
- Promise.prototype.then()
Promise.prototype.then() attaches fulfillment and rejection handlers to a Promise, returning a new Promise for chaining async operations.
- Promise.race()
Promise.race() returns a promise that settles as soon as any one promise in the iterable settles, adopting that promise's outcome as its own.
- Promise.reject()
Promise.reject() creates a rejected Promise with a given reason, useful for testing error handlers and conditionally returning failed promises in async code.
- Promise.resolve()
Promise.resolve() turns any value into a resolved Promise, handling plain values, thenables, and Promise pass-through to normalise mixed sync/async code paths.
- Promise.try()
Promise.try() wraps a sync or async callback in a Promise, converting synchronous throws into rejections without deferring the call to a microtask.
- Promise.withResolvers()
Promise.withResolvers() returns a new pending promise with its resolve and reject functions in one call, replacing the hoist-from-executor pattern.