GroupBy in Array using Reduce in Javascript
· ☕ 2 min read
There is a really cool way to do group by in an array using reduce.
The problem statement - you have an array of objects and need to create different arrays based on similar attributes. This is very similar to the SQL group by statement.
Consider the example array -