forked from M3-Academy/challenge-algorithms-v2.0
fix the mostRepeatedChar logic
This commit is contained in:
parent
923c138af6
commit
8a86015c4f
@ -3,7 +3,7 @@ export function mostUsedChar(text) {
|
|||||||
letter = "";
|
letter = "";
|
||||||
text.split("").forEach(function (char) {
|
text.split("").forEach(function (char) {
|
||||||
if (text.split(char).length > count) {
|
if (text.split(char).length > count) {
|
||||||
max = text.split(char).length;
|
count = text.split(char).length;
|
||||||
letter = char;
|
letter = char;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user