With the help of array.reduce, the Map data structure and some higher-order functions you can do a lot in JavaScript, for example, building a generic groupBy function for an array of objects.