SOURCE


var arr = [1500,1200,2000,2100,1800,600];

for(var i = 0; i < arr.length; i++){
    if(arr[i] < arr[i + 1]){
        var newarr;
        newarr = arr[i];
        arr[i] = arr[i + 1];
        arr[i + 1] = newarr;
    }
}

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

                    
>
console