Skip to content

Instantly share code, notes, and snippets.

@ppeeou
Created September 21, 2019 06:58
Show Gist options
  • Save ppeeou/64411567ab3355be333e63741a140f87 to your computer and use it in GitHub Desktop.
Save ppeeou/64411567ab3355be333e63741a140f87 to your computer and use it in GitHub Desktop.
const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo'));
const promises = [promise1, promise2];
Promise.allSettled(promises)
.then((results) => results.forEach((result) => console.log(result.status)));
// expected output:
// "fulfilled"
// "rejected"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment