SOURCE

 //快速排序,每次排序的时候设置一个基准点,将小于等于基准点的数全部放到基准点的左边,将大于等于基准点的数全部放到基准点的右边。
  function quickSort(arr){
    if(arr.length <= 1){
      return arr;
    }
    var left = [];
    var right = [];
    var temp = arr[0];
    for(var i = 1; i < arr.length; i++){
      if(arr[i] <= temp){
        left.push(arr[i]);
      }else{
        right.push(arr[i]);
      }
    }
    left.push(temp);
    left = arguments.callee(left);
    right = arguments.callee(right);
    
    return left.concat(right);
  }
  //一句话写快速排序
  function quickSort(a) {
  return a.length <= 1 ? a : quickSort(a.slice(1).filter(item => item <=a[0])).concat(a[0] , quickSort(a.slice(1).filter(item =>item>a[0])));
}
console 命令行工具 X clear

                    
>
console