← Quiz: Async JavaScript: all 10 questions
Quiz: Async JavaScript · Question 7 of 10
What does this print? (code)
What does this print?
const p = Promise.allSettled([Promise.resolve(1), Promise.reject(new Error("x"))]);
p.then((results) => console.log(results.map((r) => r.status).join(",")));
- A.fulfilled,fulfilled
- B.fulfilled,rejected
- C.rejected
- D.It throws an error
Answer & explanation
Correct answer: fulfilled,rejected
allSettled waits for all promises and reports each one's status, even failures.
Can you get the rest right without peeking?
Take the timed Quiz: Async JavaScript quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →