From 1ef4c3dd94c48141784259db576a68674f4d640c Mon Sep 17 00:00:00 2001 From: ednabarboza Date: Fri, 28 Oct 2022 09:20:54 -0300 Subject: [PATCH] feat(home):resolucao da questao 9 --- 09-mostRepeatedChar/index.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/09-mostRepeatedChar/index.js b/09-mostRepeatedChar/index.js index b113ed8..eda93a8 100644 --- a/09-mostRepeatedChar/index.js +++ b/09-mostRepeatedChar/index.js @@ -1,4 +1,27 @@ export function mostUsedChar(text) { - // implementar logica aqui - return "" + let order = text.toLowerCase().split('').sort(); + + let finalResult = ""; + let letterMostAppears = 0; + + + //console.log(order) ---> verificar se transformou em array e ordenou + + for(let i=0; i letterMostAppears){ + letterMostAppears = count; + finalResult = order[i]; + } + + } + return finalResult; } \ No newline at end of file -- 2.34.1