Recently I saw a colleague implement some functionality in which he required two results from an API using
await. The piece of code looked something like this:
The code looks fine, is syntactically correct, and works … but there’s one big problem with it: the calls are made sequentially.
To run these calls – which are promises – in parallel, one can reside to using
Promise.all. Combine that with destructuring and the code becomes this: