forked from M3-Academy/challenge-algorithms-v2.0
feat(challenge-9): completed challenge
This commit is contained in:
parent
d26209f861
commit
6801fc069d
@ -1,4 +1,15 @@
|
||||
export function mostUsedChar(text) {
|
||||
// implementar logica aqui
|
||||
return ""
|
||||
if (!text) return { error: 'Not Found Text' };
|
||||
|
||||
let max = 0,
|
||||
maxChar = '';
|
||||
|
||||
for (let char of text) {
|
||||
if (text.split(char).length > max) {
|
||||
max = text.split(char).length;
|
||||
maxChar = char;
|
||||
}
|
||||
}
|
||||
|
||||
return maxChar;
|
||||
}
|
Loading…
Reference in New Issue
Block a user