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