var array = [2,1,4,7,34,7,2344,897,8,1233,97];
for (var i = 0; i < array.length - 1; i++) {//控制躺数
//最小数的下标
var index = 0;
for (var j = 1; j < array.length - i; j++) {//次数
if(array[index] < array[j]){
index = j;
}
}
var temp = array[index];
array[index] = array[array.length - 1 - i];
array[array.length - 1 - i] = temp;
}
console.log(array);