forked from M3-Academy/challenge-algorithms-v2.0
11 lines
273 B
JavaScript
11 lines
273 B
JavaScript
export function mostUsedChar(text) {
|
|
let max = 0,
|
|
maxChar = '';
|
|
text.split('').forEach(function(char){
|
|
if(text.split(char).length > max) {
|
|
max = text.split(char).length;
|
|
maxChar = char;
|
|
}
|
|
});
|
|
return maxChar;
|
|
} |