How to use array reduce for more than just numbers

How to use array reduce for more than just numbers

The accumulator can be something completely different from the array elements. For example, our accumulator might be a string, while our array contains numbers:

Now, this is just an example to make the point. But there’s no reason that single value can’t be an array.

Source: jrsinclair.com