forked from M3-Academy/challenge-algorithms-v2.0
14 lines
299 B
JavaScript
14 lines
299 B
JavaScript
export function mostUsedChar(text) {
|
|
// implementar logica aqui
|
|
let max = 0
|
|
let maxChar = ''
|
|
|
|
text.split('').forEach((char) => {
|
|
if(text.split(char).length > max) {
|
|
max = text.split(char).length;
|
|
maxChar = char;
|
|
}
|
|
});
|
|
|
|
return maxChar
|
|
} |