feat: finalizado mostRepeatedChar

This commit is contained in:
Vitor Soares 2022-10-28 12:33:01 -03:00
parent 302ca997f6
commit b4852810c4

View File

@ -1,4 +1,14 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui // implementar logica aqui
return "" let max = 0
let maxChar = ''
text.split('').forEach((char) => {
if(text.split(char).length > max) {
max = text.split(char).length;
maxChar = char;
}
});
return maxChar
} }