Explanation | Checking if all promises fail?
I'm reading Service Worker Offline Cookbook. Following is a piece of code, that checks if all promises have rejected —
/* inside a promise */
/* reject if all promises reject */
promises.reduce((a, b) => a.catch(() => b))
.catch(() => reject(Error('All Failed'))
I do not understand how a.catch(() => b)
inside a reduce is ensuring to tell the information of failure of promises.