因此,当这个序列被排序时,我在JS中遇到了一个奇怪的排序错误:
console.log([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 9].sort());
哪种输出
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 9]
所以我尝试了另外几种情况,最后的9是0- 8,排序的效果与预期的0和1一样,但是对于2-9之间的数字,序列没有排序。
[0, 10, 11, 12, 13, 14, 15, 16, 17, 18,