feat(challenge) desafio mostRepeatedChar finalizado

This commit is contained in:
Thiago Bronisio 2022-10-29 00:26:14 -03:00
parent 345a12e798
commit 2844c0e136

View File

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