Answers for "promise.allsetteled"



/*/The Promise.allSettled() method returns a promise that resolves
after all of the given promises have either fulfilled or rejected,
with an array of objects that each describes the outcome of each promise.
const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo'));
const promises = [promise1, promise2];

  then((results) => results.forEach((result) => console.log(result)));

// expected output:
>  { status: "fulfilled", value: 3 }
>  { status: "rejected", reason: "foo" }
Posted by: Guest on August-20-2021

Code answers related to "promise.allsetteled"

Code answers related to "Javascript"

Browse Popular Code Answers by Language