rename distinctValuesOfArray into uniqueElements

This commit is contained in:
Stefan Feješ
2018-01-17 18:02:49 +01:00
parent 43d846a5e1
commit 33f610c28d
2 changed files with 13 additions and 13 deletions

View File

@ -0,0 +1,13 @@
### uniqueElements
Returns all unique values of an array.
Use ES6 `Set` and the `...rest` operator to discard all duplicated values.
```js
const uniqueElements = arr => [...new Set(arr)];
```
```js
uniqueElements([1, 2, 2, 3, 4, 4, 5]); // [1,2,3,4,5]
```