Quiz de JavaScript: Promise.all, allSettled, race & any

JavaScript has four ways to combine promises, and each one reacts differently to failures. This quiz tests Promise.all(), Promise.allSettled(), Promise.race() and Promise.any(), the order of their results and what they do when something rejects.

Médio 10 perguntas ~6 minutos Aprovação com 80% Node.js 22

Escolha um modo

Jogando como visitante: entre para guardar seu XP e sua sequência.

Pergunta de exemplo

Pergunta 1 de 10

What does this print?

const wait = (ms, v) => new Promise(r => setTimeout(() => r(v), ms));

Promise.all([wait(10, "slow"), wait(1, "fast"), 42])
  .then(results => console.log(results.join(",")));
Mostrar a resposta

C. slow,fast,42 Promise.all() gives results in the same order as the input, no matter which finishes first. Plain values like 42 are treated as already resolved promises.

O que este quiz cobre

  • Promise.all() keeps input order and fails fast
  • Promise.allSettled() reports every result
  • Promise.race() settles with the first one to settle
  • Promise.any() and AggregateError
  • Choosing the right combinator for a real task

Perguntas frequentes

Preciso de uma conta?

Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.

Posso refazer?

Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.