var arr=[1,3,5,2,7,6,8,0,9,4];
function maopao(array){
if(Array.isArray(array)){
if (array.length == 1) {
return array;
}
var temp = null;
for (var i = 0; i < array.length; i++) {
for (var j = 0; j < array.length - i - 1; j++) {
if (array[j] > array[j + 1]) {
temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
return array;
}
}
console.log(maopao(arr));//0,1,2,3,4,5,6,7,8,9
站长微信:xiaomao0055
站长QQ:14496453