**var arr = [5,8,4,9];
for(var i =0;i<arr.length-1;i++){
for(var j = 0;j<arr.length-i-1;j++){
if(arr[j]>arr[j+1]){
var temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
//冒泡排序相当于做升序**
来源:CSDN
作者:qq_45457134
链接:https://blog.csdn.net/qq_45457134/article/details/104442006