I just realized that only the first solution (using counters) works like the browser's Promise.all. The problem with the other solutions occurs when one of the individual promises -- not the first one -- rejects before the promises before it resolve. In this case, Promise.all will wait and only reject once all the other promises resolve. In addition, the browser will throw a UnhandledPromiseRejectionWarning.
Only the first solution will not wait to reject any individual promise.
this is true. thank you! it is a good shout!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.