- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
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.
Pergunta de exemplo
Pergunta 1 de 10What 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 fastPromise.allSettled()reports every resultPromise.race()settles with the first one to settlePromise.any()andAggregateError- 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.