Answer the question
In order to leave comments, you need to log in
Is it parallel execution of promises?
There are two prescriptions
const promise1 = new Promise(...)
const promise2 = new Promise(...)
const [result1, result2] = [await promise1, await promise2]
const [result1, result2] = Promise.all([promise1, promise2])
Answer the question
In order to leave comments, you need to log in
will the execution be parallel in the first method ?
const promise1 = new Promise(...)
const promise2 = new Promise(...)
// последовательный вызов
const [result1, result2] = [await someCall(), await someOtherCall()];
// параллельный вызов
const [result1, result2] = Promise.all([someCall(), someOtherCall()]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question