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 garr1 //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...
添加回答
举报
0/150
提交
取消