冒泡排序
<script>
function sort(ar) {
for(var i=0;i<ar.length-1;i++){
for(var j=0; j<ar.length-i-1;j++){
if(ar[j]>ar[j+1]){
var temp=ar[j];
ar[j]=ar[j+1];
ar[j+1]=temp;
}
}
}
return ar;
}
var upto = sort([5,3,6,8,11,2,400]);
console.log(upto);
</script>