Develop #1

Merged
Gabriel_Ferraz_Nogueira merged 10 commits from Develop into master 2022-10-31 17:37:31 +00:00
Showing only changes of commit 985af27572 - Show all commits

View File

@ -1,4 +1,9 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
let words = {}
const texts = text.toLowerCase().split("").sort();
texts.forEach((word) => words[word] = (words[word] || 0) + 1);
const maxVal = Math.max(...Object.values(words));
const word = Object.keys(words).find((key) => words[key] === maxVal);
return word
}