This code was written for the: Breaking and taming the Promise chain in JS article posted on the RockedScience Medium publication.
Starting from the worst case scenario shown in
ugly-version.js, the code is converted
to use Promise.all() returning all values at the end of the
execution (promise-all-version.js)
and invidually at each invocation
(promise-all-improved-version.js).
The last example in tidy-version.js shows my
favourite implementation of a chain of Promises.
Please read the full article linked above for details.