Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Using Promise.all | Mastering Promises
Asynchronous JavaScript Explained

bookUsing Promise.all

script.js

script.js

index.html

index.html

copy

When you need to wait for several asynchronous operations to finish before continuing, Promise.all is the tool you use. You pass an array of Promises to Promise.all, and it returns a new Promise. This new Promise resolves only when every Promise in the array has been fulfilled. The resulting value is an array containing each Promise's resolved value, in the same order as the original array. If any of the Promises rejects, Promise.all immediately rejects with that error, and does not wait for the remaining Promises to finish. This behavior is helpful for handling multiple tasks that must all succeed before moving forward, but it also means that a single failure will stop the entire group.

question mark

What happens if one Promise in Promise.all rejects?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 7

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Awesome!

Completion rate improved to 3.57

bookUsing Promise.all

Scorri per mostrare il menu

script.js

script.js

index.html

index.html

copy

When you need to wait for several asynchronous operations to finish before continuing, Promise.all is the tool you use. You pass an array of Promises to Promise.all, and it returns a new Promise. This new Promise resolves only when every Promise in the array has been fulfilled. The resulting value is an array containing each Promise's resolved value, in the same order as the original array. If any of the Promises rejects, Promise.all immediately rejects with that error, and does not wait for the remaining Promises to finish. This behavior is helpful for handling multiple tasks that must all succeed before moving forward, but it also means that a single failure will stop the entire group.

question mark

What happens if one Promise in Promise.all rejects?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 7
some-alt