var test10Elements = [7, 6, 5, 4, 3, 2, 1, 0, 8, 9];
var comparefn = function (x, y) {
return x - y;
};
test10Elements.sort(comparefn); var comparefn2 = function (x, y) {
return x > y;
};
test10Elements.sort(comparefn2);
js 数组排序要注意的问题,返回的值最好为 -1, 0, 1之间的值-LMLPHP

http://w3help.org/zh-cn/causes/SJ9013

04-01 17:12