Merge pull request 'feature/desafiodois' (#8) from feature/desafiodois into master

Reviewed-on: #8
This commit is contained in:
ThiagoDutraSampaioLeite 2022-10-28 20:07:40 +00:00
commit efc4a73fae

View File

@ -1,4 +1,20 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui // implementar logica aqui
return "" let newText = text.toLowerCase();
let newLetterRep;
let letraRep = 0;
for (let i = 0; i < newText.length; i++) {
let letra = newText[i];
let cont = 0;
for (let j = 0; j < newText.length; j++) {
if (letra == newText[j]) {
cont++;
if (cont > letraRep) {
letraRep = cont;
newLetterRep = newText[i];
}
}
}
}
return newLetterRep;
} }