Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk2 min

What Promise.allSettled() Returns: Results, Status Values, and Input Order

Promise.allSettled() fulfills with one status-and-outcome object per input, in input order, after every input settles.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Promise.allSettled(iterable) returns a Promise that fulfills with an array of outcome objects after every input has settled. Each object has a status of "fulfilled" or "rejected", plus a value or reason, respectively. The array preserves the input order, not the order in which the operations finish.

What the returned value looks like

The method accepts an iterable, such as an array, and returns a Promise. Once all inputs have fulfilled or rejected, the returned Promise fulfills with an array containing one outcome object for each input. Promise resolution assimilates thenables, and ordinary non-promise values count as fulfilled inputs.

As an Amazon Associate I earn from qualifying purchases.

const results = await Promise.allSettled([
  Promise.resolve("profile"),
  Promise.reject(new Error("offline")),
]);

// results:
// [
//   { status: "fulfilled", value: "profile" },
//   { status: "rejected", reason: Error("offline") },
// ]

This is an array of outcome records, not an array filtered to contain only successful values. An input rejection appears in its record; it does not, by itself, reject the aggregate Promise.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The two status values and their properties

Outcome Object shape Read this property
Fulfilled { status: "fulfilled", value } value
Rejected { status: "rejected", reason } reason

Branch on status before reading the corresponding property. For example:

for (const result of results) {
  if (result.status === "fulfilled") {
    console.log("Value:", result.value);
  } else {
    console.error("Reason:", result.reason);
  }
}

Results follow input order, not completion order

The result at index i corresponds to the input at index i, even if that operation finishes after later inputs. The aggregate waits until every outcome is known, then provides the records in the order the inputs were passed. That positional relationship makes it possible to associate results with the original inputs by index.

If you destructure or otherwise assign results to named variables, keep that assignment order aligned with the input order; a mismatch can associate an outcome with the wrong task.

What happens with an empty iterable or settled inputs

An empty iterable produces a Promise that is already fulfilled with an empty array. With a non-empty iterable containing no pending promises, fulfillment still occurs asynchronously.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to use allSettled() instead of all()

Use Promise.allSettled() when the tasks are independent and you need to inspect every success and failure, such as when gathering several optional results. Use Promise.all() when all inputs must succeed or an input rejection should reject the combined Promise. For its return shape and behavior, see MDN’s Promise.allSettled() reference; the algorithm is specified in ECMA-262, 15th edition (June 2024).

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.