forked from M3-Academy/challenge-algorithms-v2.0
15 lines
394 B
JavaScript
15 lines
394 B
JavaScript
export function mostUsedChar(text) {
|
|
// implementar logica aqui
|
|
let max = 0;
|
|
let maxChar = "";
|
|
const splitLetras = text.split("");
|
|
splitLetras.map( char=> {
|
|
const splitCaracter = text.split(char);
|
|
if (splitCaracter.length > max) {
|
|
max = splitCaracter.length;
|
|
maxChar = char;
|
|
}
|
|
});
|
|
|
|
return maxChar;
|
|
} |