Groups the elements of an array based on the given function and returns the count of elements in each group
countBy([6.1, 4.2, 6.3], Math.floor); // { 4: 1, 6: 2 }
countBy(['one', 'two', 'three'], 'length'); // { 3: 2, 5: 1 }
Generated using TypeDoc
Groups the elements of an array based on the given function and returns the count of elements in each group
Example
Example