SOURCE

var arr=[12,4,5,78,900,32,65,78,43,123];
arr.sort(function(a,b){
    if(a > b){                //小到大排序
    // if(a < b){                   //大到小排序
        return 1;
    }else if(a == b){
        return 0;
    }else{
        return -1;
    }
});

console.log(arr);
console 命令行工具 X clear

                    
>
console