This pattern enables sequential processing of promises (tasks) as well as capturing
and collecting the return values.
The function which is passed in itself takes at least two parameters: the previous and the current
value, in this case, the promise chain and a value which will be used to create a promise task.
The initial value (last parameter) of the reducer function is a promise which immediately resolves
to an empty array.
The reducer function operates by executing the promise chain and then the current task AS WELL AS then
collecting up the return values which are then available at the end.
In the following JDoodle execute
the code to see how this works in practice.