diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..5e2051b 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,15 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + 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; } \ No newline at end of file