challenge-algorithms-v2.0-F.../09-mostRepeatedChar/index.js

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