js中文按字母排序
2016-10-15 Js 1152
window.onload = function(){
var city = ["北京","上海","深圳","武汉","济南","天津"];
console.log(city);
city.sort(function(param1,param2){
return param1.localeCompare(param2);
});
console.log(city);
}
window.onload = function(){ var city = ["北京","上海","深圳","武汉","济南","天津"]; console.log(city); city.sort(function(param1,param2){ return param1.localeCompare(param2); }); console.log(city); }
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论