feat(mostRepeatedChar): adiciona resolucao questao09-mostrepeatedchar #9

Merged
carloswinter merged 1 commits from feature/mostRepeatedChar into development 2022-10-28 19:17:07 +00:00
Showing only changes of commit e4e94adf5e - Show all commits

View File

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