Created
July 29, 2024 14:45
-
-
Save hctilg/f7a0772322224e38ab096f6ad85d682a to your computer and use it in GitHub Desktop.
Remove duplicates in Javascript
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 remove_duplicates = _array => { | |
let unique = []; | |
_array.forEach(element => { | |
if (!unique.includes(element)) unique.push(element); | |
}); | |
return unique; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment