Question PRG-JS-0070
HardWhat is the output of this program?
const p = Promise.all([Promise.resolve(1), 2, new Promise(r => setTimeout(() => r(3), 10))]);
const q = Promise.allSettled([Promise.reject(new Error("x")), Promise.resolve(4)]);
Promise.all([p, q]).then(([a, b]) => console.log(a, b.map(s => s.status)));
- A.
[ 1, 2 ] [ 'rejected', 'fulfilled' ]
- B.
[ 1, 2, 3 ] [ 'rejected', 'fulfilled' ]
- C.
Sign up free to see the answer and a step-by-step explanation.