diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..87367f7 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,17 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + + let max = 0; + let maxCaracter = ""; + + text.split('').forEach((caracter) => { + if (text.split(caracter).length > max) { + max = text.split(caracter).length; + + maxCaracter = caracter; + } + }); + + + return maxCaracter; } \ No newline at end of file