resolving an array of promises from within a parent promise

Return all the promises!

Promises are just return values you attach callbacks to, instead of passing callbacks into functions. Unless you return all of them, there’s no way for the callbacks to chain, or catch all their errors.

Also, return from all the .then‘s the instant you have another promise. This flattens things.

Leave a Comment