forked from M3-Academy/challenge-algorithms-v2.0
12 lines
246 B
JavaScript
12 lines
246 B
JavaScript
export function mostUsedChar(text) {
|
|
let count = 0,
|
|
letter = "";
|
|
text.split("").forEach(function (char) {
|
|
if (text.split(char).length > count) {
|
|
max = text.split(char).length;
|
|
letter = char;
|
|
}
|
|
});
|
|
return letter;
|
|
}
|