📜  如何在 javascript 代码示例中检查重复的语法

📅  最后修改于: 2022-03-11 15:01:26.286000             🧑  作者: Mango

代码示例1
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