HardModern JS💻 Output Question

Promise.allSettled handles mixed results

💡

Hint

Promise.allSettled waits for ALL regardless of outcome. Promise.all fails fast on first rejection.

What does this output?

Promise.allSettled([
  Promise.resolve(1),
  Promise.reject('err'),
  Promise.resolve(3),
]).then(results => {
  console.log(results[0].status);
  console.log(results[1].status);
  console.log(results[1].reason);
});

Correct Output

fulfilled
rejected
err

Why this output?

Explanation: allSettled never rejects. Each result has status + value (fulfilled) or reason (rejected).

Key Insight: Promise.allSettled waits for ALL regardless of outcome. Promise.all fails fast on first rejection.

More Modern JS Output Questions

EasyDestructuring defaults apply only for undefinedEasyObject spread — later properties winMediumOptional chaining prevents TypeError on missing propertiesMediumNullish coalescing ?? vs OR ||

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz