forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(challenge) desafio mostRepeatedChar finalizado' (#9) from feature/repeatChar into master
Reviewed-on: #9
This commit is contained in:
commit
50a435b901
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user