Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-22 20:24:44 +03:00
parent 5cb69e3c5c
commit aa425812b4
40 changed files with 151 additions and 87 deletions

View File

@ -3,9 +3,10 @@ title: uniqueElements
tags: array,beginner
---
Returns all unique values in an array.
Finds all unique values in an array.
- Create a `Set` from the given array to discard duplicated values, then use the spread operator (`...`) to convert it back to an array.
- Create a `new Set()` from the given array to discard duplicated values.
- Use the spread operator (`...`) to convert it back to an array.
```js
const uniqueElements = arr => [...new Set(arr)];