add mostUsedChar logic

This commit is contained in:
Marcela Mathias 2022-11-02 21:37:28 -03:00
parent 07f5b2dd39
commit 8efeb4b881

View File

@ -1,4 +1,11 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui let count = 0,
return "" letter = "";
} text.split("").forEach(function (char) {
if (text.split(char).length > count) {
max = text.split(char).length;
letter = char;
}
});
return letter;
}