forked from M3-Academy/challenge-algorithms-v2.0
feat(challenge) desafio mostRepeatedChar finalizado
This commit is contained in:
parent
345a12e798
commit
2844c0e136
@ -1,4 +1,12 @@
|
|||||||
export function mostUsedChar(text) {
|
export function mostUsedChar(text) {
|
||||||
// implementar logica aqui
|
// 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