Skip to content

Instantly share code, notes, and snippets.

@adrianhorning08
Created May 15, 2018 20:45
Show Gist options
  • Save adrianhorning08/5005f46e4acca88588fbe5b017fd2783 to your computer and use it in GitHub Desktop.
Save adrianhorning08/5005f46e4acca88588fbe5b017fd2783 to your computer and use it in GitHub Desktop.
function findDups(arr) {
const set = new Set();
const result = [];
arr.forEach(el => {
if (set.has(el)) {
result.push(el);
} else {
set.add(el);
}
})
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment