feat(mostUsedChar): fazendo funcão

This commit is contained in:
Caroline Moran 2022-10-28 07:44:38 -04:00
parent 401b1cc7ac
commit 0295676121

View File

@ -1,4 +1,10 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui // implementar logica aqui
return "" let textLower = text.toLowerCase().split("").sort();
for (let index = 1; index < textLower.length; index++) {
textLower = textLower.filter((e, i, a) => a.indexOf(e) !== i);
}
let letter = [...new Set(textLower)];
return letter.join("");
} }