function getCount(str) { for(var code=32;code<128;code++){ var mych=String.fromCharCode(code); var count=0; for(var i=0;i<str.length;i++){ var ch=str.charAt(i); if(ch===mych){ count++; } } if(count>0){ console.log("字符"+mych+"出现了"+count+"次"); } } }
请找出"aaaabbcccdddd"字符串中出现最多的字母
猜你喜欢
转载自www.cnblogs.com/wuqilang/p/11366989.html
今日推荐
周排行