<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
var str ='adadsadsaadassadsaasdfdf';
var json = {};
for(var i = 0; i < str.length; i++){
if(json[str[i]]){
json[str[i]]++;
}else{
json[str[i]] = 1;
}
}
console.log(json);
var n = 0;
var s = '';
for(var name in json){
if(n < json[name]){
n = json[name];
s = name;
}
}
alert('出现次数最多的字母是:' + s + '出现了:' + n + '次');
</script>
</head>
<body>
</body>
</html>