Groups the elements of an array based on the given function.
This function takes an array and a grouping function, and returns an object
where each key is a value returned by the grouping function, and the value
is an array of elements that produced that key.
Groups the elements of an array based on the given function.
This function takes an array and a grouping function, and returns an object where each key is a value returned by the grouping function, and the value is an array of elements that produced that key.
根据给定函数对数组元素进行分组。
此函数接收一个数组和一个分组函数,返回一个对象,其中每个键是由分组函数返回的值, 值是产生该键的元素数组。