develop #1

Merged
emersonfully merged 10 commits from develop into master 2022-11-02 02:56:02 +00:00
Showing only changes of commit 0eecc63f1c - Show all commits

View File

@ -1,4 +1,23 @@
export function mostUsedChar(text) { export function mostUsedChar(text) {
// implementar logica aqui // implementar logica aqui
return "" const charMap = {};
let max = 0;
let frequentChar = '';
for (let char of text) {
if (charMap[char]){
charMap[char]++;
} else {
charMap[char] = 1;
}
}
for (let char in charMap) {
if (charMap[char] > max) {
max = charMap[char];
frequentChar = char;
}
}
return frequentChar
} }