Created
November 26, 2018 21:54
-
-
Save veritstudio/ff29eb3e3d2ae9efdc76a66cbcda3d84 to your computer and use it in GitHub Desktop.
Remove duplicates 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
let names = ['John', 'Alice', 'John', 'Jake', 'Jane', 'Jake']; | |
function removeDuplicates(duplicates) { | |
return Array.from(new Set(duplicates)); | |
} | |
names = removeDuplicates(names); | |
console.log(names); //output: ["John", "Alice", "Jake", "Jane"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment