Is await Promise.all() equivalent to an array [await, await]?

Viewed 2174

I wonder if the two following pieces of JavaScript code are equivalent:

Using await Promise.all:

[foo, bar] = await Promise.all([getFoo(), getBar()])

Using an array with await:

[foo, bar] = [
  await getFoo(),
  await getBar()
]
0 Answers
Related