You're exactly right... and it does so by returning a Promise itself.
Since it returns a Promise, it's await-able in the context of an async function like the code here.
Depends on the expectations of the calling code of course, but if the calling code is expecting the value as opposed to the Promise, it might be worth considering an await
(and you might want to
await
thatPromise.all()
)Promise.all()
waits for all fulfillments (or the first rejection).developer.mozilla.org/en-US/docs/W...
You're exactly right... and it does so by returning a
Promise
itself.Since it returns a
Promise
, it'sawait
-able in the context of anasync
function like the code here.Depends on the expectations of the calling code of course, but if the calling code is expecting the value as opposed to the
Promise
, it might be worth considering anawait
e.g.