IE and Chrome Firefox sorting compatibility problem, sort by zh-Hans-CN

var chineseArr = ["", "", "", "", "Goolge", "AHHH"];
var newChineseArr = chineseArr.sort(function (a, b) {
    return a.localeCompare(b, "zh-Hans-CN", {sensitivity: "accent"});
});
console.log(newChineseArr);

Export Ali, Baidu, Huawei and Tencent, AHHH, Goolge, under Chrome and Firefox
export AHHH, Goolge, Ali, Baidu, Huawei and Tencent
under IE. It is mainly the problem of zh-Hans-CN

Jul.06,2021

Let the backend handle it. Add a sort field to each information, and then look it up according to the sort field when you check it


it is estimated to be difficult.

another solution is provided here. Refer to a Chinese-to-pinyin library ( pinyinjs ) to convert Chinese to Pinyin first, and then make a comparison.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e93126-45eab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e93126-45eab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?