Remove duplicates from a JavaScript Array

By making use of Sets and the spread operator, we can quickly strip the duplicates with a Set then turn it back into an array in no time. 


```
[…new Set([1, 'Graffino', 1, 'Graffino', "Wha!"])];
```

Will return: [1, "Graffino", "Wha!"]

Nick Ciolpan
04 Sep 2020
« Back to post