development #1

Merged
MarcelloMartins merged 23 commits from development into master 2022-10-31 21:45:09 +00:00
Showing only changes of commit fabfc5a6f1 - Show all commits

View File

@ -1,4 +1,16 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui // implementar logica aqui
return "" let caractercount = 0; let caractersave = {}; let caracter = " ";
text.split("").forEach((repetido) => {
if(caractersave[repetido]){
caractersave[repetido] += 1;
} else{
caractersave[repetido] = 1;
}
if(caractersave[repetido] > caractercount){
caractercount = caractersave[repetido];
caracter = repetido;
}
});
return caracter;
} }