forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(mostRepeatedChar): adiciona resolucao questao09-mostrepeatedchar' (#9) from feature/mostRepeatedChar into development
Reviewed-on: #9
This commit is contained in:
commit
13f8ba9df7
@ -1,4 +1,12 @@
|
|||||||
export function mostUsedChar(text) {
|
export function mostUsedChar(text) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
return ""
|
let max = 0;
|
||||||
|
let maxRepeated = '';
|
||||||
|
text.split('').forEach(function(char){
|
||||||
|
if(text.split(char).length > max) {
|
||||||
|
max = text.split(char).length;
|
||||||
|
maxRepeated = char;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return maxRepeated;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user