forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(desafio09):desafio-completo' (#9) from feature/desafio09 into develop
Reviewed-on: #9
This commit is contained in:
commit
5767c61eb4
@ -1,4 +1,19 @@
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user