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);
http://w3help.org/zh-cn/causes/SJ9013