JSFiddle - React, Tailwind, and code Playground
by karthick6891
HTML
<!-PROMISE->
PROMISE
JavaScript
const p1 = new Promise(resolve => resolve('test'))
const p2 = new Promise((resolve, reject) => reject('test failed'))
const p3 = new Promise(resolve => resolve('test again'))
// Throws only error
Promise.all([p1, p2, p3]).then(response => console.log(response)).catch(error => console.error(error));
/* shows
0: {status: "fulfilled", value: "test"}
1: {status: "rejected", reason: "test failed"}
2: {status: "fulfilled", value: "test again"} */
Promise.allSettled([p1, p2, p3]).then(response => console.log(response)).catch(error => console.error(error));