2.0.0 • Published 3 years ago

yz-sort v2.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
3 years ago

#杨招十多个

/封装函数
function Sort(arr){ 
 //定义循环
 for(let i=0;i<arr.length;i++){

    for(let j=0;j<arr.length-1;j++){
        //判断
        if(arr[i]<arr[j]){

          let tems =arr[i];
          arr[i]=arr[j];
          arr[j] =tems;
        }
    }
 }
   //返回
   return arr;
}

//定义一个数组
let read = Sort([1,2,4,6,7,8,1111,333,5,6]);

console.log(read);