Example 1 — Official: Group by Math.floor
Numbers sharing the same floor land in the same array.
_.groupBy([6.1, 4.2, 6.3], Math.floor);
// → { "4": [4.2], "6": [6.1, 6.3] } How It Works
- Iteratee.
Math.floorturns each number into an integer key. - First 6.x.
6.1opens bucket"6". - 4.2. Opens bucket
"4". - Second 6.x.
6.3appends to the existing"6"array.

