1、给乱序的字母按字典顺序排序;要求:h H H i I a A a->a a A h H H i I 

<script>
var arr = ['A','a','y','Y','y','R','s','T','t','R','s','S','r'];//->a,A,r,R,R,s,s,S,t,T...
var o = {};
arr.sort();
for(var i=0;i<arr.length;i++){//给相同字母分组
s = arr[i].toLowerCase();
if(!o[s]){
o[s] = [];
}
o[s].push(arr[i]);

}
for( p in o){ //给分完组的排序;
o[p] = o[p].sort().reverse();
}
var str = '';
for( p in o){
for(var i=0;i<o[p].length;i++)
str = str + o[p][i];
}

console.log(str);
</script>