Implement a function groupBy(array, keyOrFn) that groups elements of an array into an object based on a function or property name.
The function should:
Example
groupBy([6.1, 4.2, 6.3], Math.floor); // { '4': [4.2], '6': [6.1, 6.3] } groupBy(['one', 'two', 'three'], 'length'); // { '3': ['one', 'two'], '5': ['three'] }
JavaScript Function
No test results yet
Click "Run" to execute tests