forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(challenge-9): completed challenge' (#9) from feature/challenge-9 into develop
Reviewed-on: #9
This commit is contained in:
commit
04bbc0e63b
@ -1,4 +1,15 @@
|
|||||||
export function mostUsedChar(text) {
|
export function mostUsedChar(text) {
|
||||||
// implementar logica aqui
|
if (!text) return { error: 'Not Found Text' };
|
||||||
return ""
|
|
||||||
}
|
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