var quickSort = function(arr) {
if(arr.length<=1) return arr;
var left = [], right = [], point = Math.floor(arr.length/2);
var middle = arr.splice(point, 1)[0];
for(var i = 0; i < arr.length; i++){
arr[i] < middle ? left.push(arr[i]) : right.push(arr[i]) ;
}
return quickSort(left).concat([middle], quickSort(right));
}