Snippet format update
To match the starter (for the migration)
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
### countBy
|
||||
---
|
||||
title: countBy
|
||||
tags: array,object,intermediate
|
||||
---
|
||||
|
||||
Groups the elements of an array based on the given function and returns the count of elements in each group.
|
||||
|
||||
@ -16,4 +19,4 @@ const countBy = (arr, fn) =>
|
||||
```js
|
||||
countBy([6.1, 4.2, 6.3], Math.floor); // {4: 1, 6: 2}
|
||||
countBy(['one', 'two', 'three'], 'length'); // {3: 2, 5: 1}
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user