Reputation: 97
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?
Upvotes: 1
Views: 567
Reputation: 664484
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.
Upvotes: 6