我有相同的数组与字符串,但他们的it数组不正确排序,它是从我的电脑复制.items在浏览器中输入.
https://jsfiddle.net/acc8xf0g/
var items = ["hard", "intermediate", "easy"];
var it = [
"intermediate",
"hard",
"?asy"
];
items.sort(function(a, b) {
return a.localeCompare(b);
});
it.sort(function(a, b) {
return a.localeCompare(b);
})
$("#test").html(items.join(" "));
$("#test2").html(it.join(" "));
Run Code Online (Sandbox Code Playgroud)
这不是e"еasy"中的ascii (在你的it数组中).
这是西里尔语?:http://www.fileformat.info/info/unicode/char/0435/index.htm
只需删除'e'并再次正常输入即可.
更新小提琴:https://jsfiddle.net/acc8xf0g/2/
| 归档时间: |
|
| 查看次数: |
76 次 |
| 最近记录: |