按升序对数组中的数字进行排序:
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return a-b});
按降序对数组中的数字进行排序:
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return b-a});
按升序对数组中的数字进行排序:
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return a-b});
按降序对数组中的数字进行排序:
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return b-a});
5万+

被折叠的 条评论
为什么被折叠?