Added samples
This commit is contained in:
@ -4,4 +4,5 @@ Use `reduce()` to increment a counter each time you encounter the specific value
|
||||
|
||||
```js
|
||||
const countOccurrences = (arr, value) => arr.reduce((a, v) => v===value ? a + 1 : a + 0, 0);
|
||||
// countOccurrences([1,1,2,1,2,3], 1) -> 3
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user