feat: adicionando solução do 9° desafio

This commit is contained in:
Ana Carolina Duarte Cavalcante 2022-10-28 08:51:23 -03:00
parent e78fc6780f
commit ef2c7d7aef

View File

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