Skip to content

Instantly share code, notes, and snippets.

@berat
Created June 22, 2020 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berat/fec833c313f036d56c0e49a4284cd631 to your computer and use it in GitHub Desktop.
Save berat/fec833c313f036d56c0e49a4284cd631 to your computer and use it in GitHub Desktop.
let arr = [1, 2, 3, 3, 4, 5, 6, 7, 7, 7];
const findDuplicates = (arr) => arr.filter(( item, index ) => arr.indexOf(item) != index);
console.log([...new Set(findDuplicates(arr))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment