Update and rename count-occurences-of-a-value-in-array.md to count-occurrences-of-a-value-in-array.md

This commit is contained in:
Jon Galloway
2017-12-11 11:30:54 -08:00
committed by GitHub
parent d2719d8a2a
commit de598a48b4

View File

@ -1,7 +1,7 @@
### Count occurences of a value in array
### Count occurrences of a value in array
Use `filter()` to create an array containing only the items with the specified value, count them using `length`.
```js
var countOccurences = (arr, value) => arr.filter(v => v === value).length;
var countOccurrences = (arr, value) => arr.filter(v => v === value).length;
```