利用sort 进行汉字的排序

 

 

 

根据汉字首字母a---z进行排序

let arry = ['周浩','李媛','王五','安妮']

arry.sort(function(a,b){
  return a.localeCompare(b)
})
console.log(arry)

["安妮", "李媛", "王五", "周浩"]

 

相关文章:

  • 2021-11-15
  • 2022-12-23
  • 2021-07-25
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-08-26
猜你喜欢
  • 2022-12-23
  • 2021-05-23
  • 2021-06-23
  • 2021-07-14
  • 2022-12-23
相关资源
相似解决方案