Nearby lessons
18 of 22JavaScript: Promise.all()
📌 What is Promise.all()?
Promise.all() takes an array of promises and returns a single Promise that resolves when all of the input promises have resolved, or rejects if any promise rejects. It's commonly used for running multiple asynchronous tasks in parallel.
1️⃣ All Promises Resolve Successfully
When all promises resolve, Promise.all() returns an array of results in the same order.
Code Example
PREVIEW READY
2️⃣ One Promise Fails and Others Resolve
If any promise is rejected, Promise.all() immediately rejects and skips the remaining results.
Code Example
PREVIEW READY
🧠 Test Your Knowledge
3 QuestionsProgress: 0 / 3
Keep Going!AJS - AJAX