forked from M3-Academy/challenge-algorithms-v2.0
add mostUsedChar logic
This commit is contained in:
parent
07f5b2dd39
commit
8efeb4b881
@ -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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user