// 插入排序实现 function insetSort(arr){ for(let i=0;i<arr.length;i++){ for(let j=i;j>0;j--){ if(arr[j]<arr[j-1]){ let temp = arr[j] arr[j] = arr[j-1] arr[j-1] = temp } } } return arr } const arr = [3,33,6,8,5,9,1,6,8,2] console.log(insetSort(arr))