Merge pull request 'feat(challenge-9): completed challenge' (#9) from feature/challenge-9 into develop

Reviewed-on: #9
This commit is contained in:
Henrique Santos Santana 2022-10-28 00:35:43 +00:00
commit 04bbc0e63b

View File

@ -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;
} }