Created
May 15, 2018 20:45
-
-
Save adrianhorning08/5005f46e4acca88588fbe5b017fd2783 to your computer and use it in GitHub Desktop.
This file contains 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
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