const quickSort = arr => {
if (arr.length <= 1) return arr;
let [pivot, left, right] = [arr[arr.length - 1], [], []];
for (let i = 0; i < arr.length - 1; i++) arr[i] < pivot ? left.push(arr[i]) : right.push(arr[i]);
return [...quickSort(left), pivot, ...quickSort(right)];
};