function quickSort(arr) {
if(arr.length < 2) {
return arr;
}
var pointIndex = Math.floor(arr.length/2);
var point = arr.splice(pointIndex, 1)[0];
var left = [], right = [];
for(var i = 0; i < arr.length; i++) {
if(arr[i] < point) {
left.push(arr[i]);
} else {
right.push(arr[i]);
}
}
return quickSort(left).concat(point,quickSort(right));
}
var arr = [500,8,5,4,69,25,36,755,1];
console.log(quickSort(arr));