Answers for "javascript compare duplicates in array"

0

javascript compare duplicates in array

let strArray = [ "q", "w", "w", "w", "e", "i", "u", "r"];
let findDuplicates = arr => arr.filter((item, index) => arr.indexOf(item) != index)

console.log(findDuplicates(strArray)) // All duplicates
console.log([...new Set(findDuplicates(strArray))]) // Unique duplicates
Posted by: Guest on April-22-2020

Code answers related to "javascript compare duplicates in array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language