Created
March 14, 2017 21:14
-
-
Save TravelingTechGuy/6a84e2d1a1c5da3cdf3ba385d2edbec3 to your computer and use it in GitHub Desktop.
Ensure an array contains unique elements, using a Set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr = [2, 3, 5, 2, 1, 3]; | |
arr = [...new Set(arr)]; //arr now contains [2, 3, 5, 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment