DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: Group and count values in an array

This is a perfect opportunity to use Array#reduce. That function will take a function that is applied to all elements of the array in order and can be used to accumulate a value. We can use it to accumulate an object with the various counts in it.

To make…

Top comments (0)