Skip to content

Instantly share code, notes, and snippets.

@lenivene
Last active June 20, 2020 13:43
Show Gist options
  • Save lenivene/20eab2efce29ce427c492d5e342b3f6c to your computer and use it in GitHub Desktop.
Save lenivene/20eab2efce29ce427c492d5e342b3f6c to your computer and use it in GitHub Desktop.
Remove duplicate values from array
const array = ["Lenivene", "World", "Bezerra", "Hello", "Lenivene"];
array.reduce((unique, item) => {
return unique.includes(item) ? unique : [...unique, item]
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment