js 数组排序要注意的问题,返回的值最好为 -1, 0, 1之间的值
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);


浙公网安备 33010602011771号