我需要以大写字母在前的方式对两个字符串进行排序,即使对于不同的字母也是如此,例如:
猫先于蚂蚁
CD出现在CD之前
我可以使用 localCompare 进行这样的排序吗?
const sortString = (a, b) => String(a).localeCompare(b);
javascript sorting case-sensitive
case-sensitive ×1
javascript ×1
sorting ×1