arr.sort(function (a, b){ return a - b; }); //正序排列数字
arr.sort(function (a, b){ return b - a; }); //倒序排列数字