用js使列表里的纯数字排序(冒泡)
用js使列表里的纯数字排序(冒泡)
let a = [9,2,33,66,55,56,34,1,91,88];
for(let i=0;i<a.length;i++){
for(let j=0;j<a.length-i;j++){
if(a[j]>a[j+1]){
let e= a[j];
a[j]=a[j+1];
a[j+1]=e;
}
}
}
console.log(a);
...
原创
2021-08-30 20:45:22 ·
80 阅读 ·
0 评论