Closed RazvanBugoi closed 4 years ago
function duplicateCount(text){
text = text.toLowerCase();
let obj ={};
for (let i=0; i<text.length; i++) {
if(text[i] in obj) {
obj[text[i]] += 1;
} else {
obj[text[i]] = 1;
}
}
return Object.values(obj).filter((el) => el > 1).length;
}
https://www.codewars.com/kata/54bf1c2cd5b56cc47f0007a1/train/javascript