字符串在Javascript中无法正确排序

Pav*_*vel 0 javascript

我有相同的数组与字符串,但他们的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)

Pau*_*aul 5

这不是e"еasy"中的ascii (在你的it数组中).

这是西里尔语?:http://www.fileformat.info/info/unicode/char/0435/index.htm

只需删除'e'并再次正常输入即可.

更新小提琴:https://jsfiddle.net/acc8xf0g/2/