- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di 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.
Domanda di esempio
Domanda 1 di 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(",")));
Mostra la risposta
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.
Cosa copre questo quiz
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
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.