js实现按照首字母排序

第一种方法:

  obj.sort((a,b)=>{a.pinyin.charCodeAt(0)-b.pinyin.charCodeAt(0)})

第二种方法:
  sort((a,b)=>a.pinyin.localeCompare(b.pinyin))

原文地址:https://www.cnblogs.com/dongyuezhuang/p/11544622.html