首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
js对汉字首字母排序
js对汉字首字母排序
mac
2022-06-30
27
var city = ["北京","天津","上海","重庆","杭州"];city.sort(
function
compareFunction(a,b){
return
a.localeCompare(b); }); console.log(city); ==>["北京", "重庆", "杭州", "上海", "天津"]
转载于:https://www.cnblogs.com/chengkun101/p/4934015.html
相关资源:js获取汉字首字母并排序
转载请注明原文地址: https://mac.8miu.com/read-52267.html
最新回复
(
0
)