Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.