Skip to content

Instantly share code, notes, and snippets.

@veritstudio
Created November 26, 2018 21:54
Show Gist options
  • Save veritstudio/ff29eb3e3d2ae9efdc76a66cbcda3d84 to your computer and use it in GitHub Desktop.
Save veritstudio/ff29eb3e3d2ae9efdc76a66cbcda3d84 to your computer and use it in GitHub Desktop.
Remove duplicates from array
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