var str = "A F a m o u s S a y i n g M u c h A d o A b o u t N o t h i n g";
var arr1 = str.split(" ");
arr1.sort(function(v1,v2){
var code1 = v1.toUpperCase().charCodeAt(0);
var code2 = v2.toUpperCase().charCodeAt(0);
return code1-code2;
});
str //A F a m o u s S a y i n g M u c h A d o A b o u t N o t h i n g
arr1 //A a A A a b c d F g g h h i i M m n n N o o o o s S t t u u u y
根据我的构想,arr1应该是A a a A A...
相关分类