Swap, anagrams, occurences

Fixed sorting title for strings.
This commit is contained in:
Angelos Chalaris
2017-12-06 23:50:23 +02:00
parent e86bf2ffa3
commit f40115ff3b
5 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,7 @@
### Count occurences 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;
```