Make an array called `equal` before making the `less` and `greater` arrays.
const equal = arr.filter(i => i === pivot);
return [ ...quicksort(less), ...equal, ...quicksort(greater) ]
Make an array called `equal` before making the `less` and `greater` arrays.
Then, instead of adding the pivot, add the equal array.