SOURCE

var str = "abcoefoxyozzoppoowwacebfxyxya";
var o = {};

for(var i = 0; i < str.length; i++){
    var chars = str.charAt(i)
    if(o[chars]){
        o[chars]++;
    }else {
        o[chars] = 1;
    }
    // console.log(str[i]);
    // console.log(o[chars])
}

var max = '';
var chars = ''
for(var k in o){
    if(o[k] > max){
        max = o[k];
        chars = k
    }
}
console.log('出现次数最多的字母是:' + chars + ', 出现的次数是:' + max);
console.log(chars)


console 命令行工具 X clear

                    
>
console