challenge-algorithms-v2.0-c.../09-mostRepeatedChar/index.js
2022-10-28 07:44:38 -04:00

11 lines
320 B
JavaScript

export function mostUsedChar(text) {
// implementar logica aqui
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("");
}