标签: javascript sorting
我在Chrome和Edge中使用"-1"比较包含"1","0"和String.prototype.localeCompare()的字符串时,注意到以下返回值的差异:
"-1"
"1"
"0"
String.prototype.localeCompare()
"1".localeCompare("-1"); // Edge: -1, Chrome: 1 "0".localeCompare("-1") // Edge: -1, Chrome: 1 "-1".localeCompare("1") // Edge: 1, Chrome: -1