Merge pull request 'feat(challenge) desafio mostRepeatedChar finalizado' (#9) from feature/repeatChar into master

Reviewed-on: #9
This commit is contained in:
Thiago Bronisio Damascena 2022-10-29 03:26:32 +00:00
commit 50a435b901

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;
}