Node.js · Junior · Question 38 of 75

How do you run two independent async requests in parallel and wait for both?

Explanation

Two awaits in a row run one after another, so the total time is the sum. Promise.all starts both at once and rejects as soon as one fails; Promise.allSettled waits for all results.

Further reading

Problem with a question

Node.js · Junior · question 38

Test yourself

Take the Node.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz