SOURCE

function arrSlice(arr){
  if(arr.length==1) {
    return arr;
  }
  let midleIndex=Math.floor(arr.length/2);
  let left=arrSlice(arr.slice(0,midleIndex))
  let right=arrSlice(arr.slice(midleIndex))
  return arrSort(left,right)
}
function arrSort(left,right){
  let i=0,j=0;
  let Arr=[];
  while(i<left.length&&j<right.length){
    if(left[i]<right[j]){
      Arr.push(left[i++])
    }else{
      Arr.push(right[j++])
    }
  }
  return Arr.concat(i<left.length?left.slice(i):right.slice(j))
}
console.log(arrSlice([5,6,123,354,123,453,234,67,89,166]))
console 命令行工具 X clear

                    
>
console