Skip to content

Instantly share code, notes, and snippets.

@TravelingTechGuy
Created March 14, 2017 21:14
Show Gist options
  • Save TravelingTechGuy/6a84e2d1a1c5da3cdf3ba385d2edbec3 to your computer and use it in GitHub Desktop.
Save TravelingTechGuy/6a84e2d1a1c5da3cdf3ba385d2edbec3 to your computer and use it in GitHub Desktop.
Ensure an array contains unique elements, using a Set
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