<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="css/lx.css">
</head>
<body>
<script>
//数组排序,不用sort();
var arr=[4,95,19,1,33,3,2];
for(var i=0;i<arr.length;i++){ //每一轮进行比较
for(var j=0;j<arr.length-i;j++){ //每一轮进行俩俩比较
var tem='';
if(arr[j]>arr[j+1]){
tem=arr[j];
arr[j]=arr[j+1];
arr[j+1]=tem;
}
}
}
console.log(arr);
</script>
</body>
</html>