0

Promise.all resolves when all the promises in its array resolves, but there is an example where an element of the input array is not a promise https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all#Using_Promise.all

so i'm wondering, can Promise.all take in an array of all non-promise elements?

icda
  • 87
  • 2
  • 9

1 Answers1

4

Promise.all calls Promise.resolve on all of the argument elements before doing anything with them. For those that already are promises, nothing happens; for thenables, they'll be converted to a proper promise, and everything else will get wrapped in a fulfilled promise.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375