feat(09-mostRepeatedChar)executa exercicio 9

This commit is contained in:
Henrique Martins Silva 2022-10-29 12:59:29 -03:00
parent 2bb129a394
commit fb7eb92a54

View File

@ -1,4 +1,26 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
let cont=0, maior=0
let resp = text.toLowerCase()
let i = 0, j = 0
for(i = 0; i < text.length; i++)
{
cont = 0
for(j = 0; j < text.length; j++)
{
if(resp[i] == text[j])
{
cont++
}
}
if(maior < cont)
{
maior = cont
var resposta = resp[i]
}
}
return resposta
}