humbertoferro #1

Merged
Humberto.Ferro merged 9 commits from humbertoferro into master 2022-10-31 21:34:30 +00:00
Showing only changes of commit 68ff6206f7 - Show all commits

View File

@ -1,4 +1,18 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
let result = '';
let mostUsedCount = 0;
for (const letter of text) {
let countLetter = 0;
for (const letterToCount of text) {
if (letterToCount === letter) {
countLetter++;
}
}
if (countLetter > mostUsedCount) {
mostUsedCount = countLetter;
result = letter;
}
}
return result;
}