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