Last active
June 20, 2020 13:43
-
-
Save lenivene/20eab2efce29ce427c492d5e342b3f6c to your computer and use it in GitHub Desktop.
Remove duplicate values from array
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
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