forked from M3-Academy/challenge-algorithms-v2.0
feat(09): finished
This commit is contained in:
parent
c220c97b54
commit
c9e9d4a2e0
@ -1,4 +1,13 @@
|
|||||||
export function mostUsedChar(text) {
|
export function mostUsedChar(text) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
return ""
|
|
||||||
|
let maxLetter = 0;
|
||||||
|
let mostUsed = '';
|
||||||
|
text.split('').forEach((letter) => {
|
||||||
|
if (text.split(letter).length > maxLetter) {
|
||||||
|
maxLetter = text.split(letter).length - 1;
|
||||||
|
mostUsed = letter;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return mostUsed;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user