diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..3e46085 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,12 @@ export function mostUsedChar(text) { // implementar logica aqui - return "" + let letraRepetida; + let str = text.toLowerCase().replace(/\,*\s/g, "").split("", text.length); + for(let i = 0; i < text.length; i++){ + for(let maisRepetida = i + 1; maisRepetida < text.length; maisRepetida++){ + letraRepetida = str[i]; + } + } + + return letraRepetida; } \ No newline at end of file