forked from M3-Academy/challenge-algorithms-v2.0
13 lines
322 B
JavaScript
13 lines
322 B
JavaScript
export function mostUsedChar(text) {
|
|
// implementar logica aqui
|
|
|
|
let maxLetter = 0;
|
|
let mostUsed = '';
|
|
text.split('').forEach((letter) => {
|
|
if (text.split(letter).length > maxLetter) {
|
|
maxLetter = text.split(letter).length;
|
|
mostUsed = letter;
|
|
}
|
|
})
|
|
return mostUsed;
|
|
} |