2022-10-27 15:07:13 +00:00
|
|
|
export function mostUsedChar(text) {
|
|
|
|
// implementar logica aqui
|
2022-10-28 21:55:51 +00:00
|
|
|
let array = text.replace('').toLowerCase().split('')
|
|
|
|
let indice;
|
|
|
|
let repeticoes=0;
|
|
|
|
let auxiliar=0;
|
|
|
|
for(let i=0;i < array.length;i++){
|
|
|
|
for(let j = 0;j < array.length;j++){
|
|
|
|
if(array[i] == array[j]){
|
|
|
|
auxiliar++
|
|
|
|
}
|
|
|
|
if(auxiliar > repeticoes){
|
|
|
|
repeticoes = auxiliar
|
|
|
|
auxiliar = 0
|
|
|
|
indice = array[i]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return indice
|
2022-10-27 15:07:13 +00:00
|
|
|
}
|