🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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(",")));
  1. A.fulfilled,fulfilled
  2. B.fulfilled,rejected
  3. C.rejected
  4. 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 →