Array Grouping (original) (raw)
callbackfn should be a function that accepts two arguments. groupBy
calls callbackfn once for each element in items, in ascending order, and constructs a new Object of arrays. Each value returned by callbackfn is coerced to a property key, and the associated element is included in the array in the constructed object according to this property key.
callbackfn is called with two arguments: the value of the element and the index of the element.
The return value of groupBy
is an object that does not inherit from %Object.prototype%.