2022-10-27 15:07:13 +00:00
|
|
|
export function mostUsedChar(text) {
|
2022-10-28 11:33:54 +00:00
|
|
|
let cont = 0, contador = 0, finalVlue;
|
2022-10-28 11:31:43 +00:00
|
|
|
let texto = text.split("");
|
|
|
|
|
|
|
|
for (let i = 0; i < texto.length; i++) {
|
|
|
|
cont = 0;
|
|
|
|
for (let j = 0; j < texto.length; j++) {
|
|
|
|
if (texto[i].toUpperCase() === texto[j].toUpperCase()) {
|
|
|
|
cont++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cont >= contador) {
|
|
|
|
contador = cont;
|
2022-10-28 11:33:54 +00:00
|
|
|
finalVlue = texto[i]
|
2022-10-28 11:31:43 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-28 11:33:54 +00:00
|
|
|
return finalVlue;
|
2022-10-27 15:07:13 +00:00
|
|
|
}
|