Recursive. I need to understand it

Tell us what’s happening:
I’ve already failed with implementing recursive in No repeats please which i couldn’t do myself. This task looks a little bit clearer though I can’t understand where to put recursive and more precisely do i need to add arguments (array, start, end) to quickSort function?
In next code i did only partitioning round and found index of pivot from which i can divide into subarrays.

Your code so far

function quickSort(array) {
// change code below this line
let pivot = array[0];
for(let i = 1; i < array.length;i++){//

  if(array[i] < pivot){
   let a = parseInt(array.splice(i,1));
 let ind = array.indexOf(pivot);
// change code above this line
return array;

console.log(quickSort([100, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36.

Challenge: Implement Quick Sort

Link to the challenge:

There is no requirement to use a recursive solution to solve the challenge.

Be careful using the splice method as it changes the array while you are still iterating over it. This can lead to unexpected results. For example, if you remove the current element being iterated over, you still are incrementing i even though there is one less element in the array. You end up skipping over elements.

I’ve just read about recursive in Get A Hint section and in pseudocode from google result so i thought another way would be too long to implement and finally i want to get how recursion works.

And by the way splice works fine when pivot is chosen from start position, if it would be in the end it would be broken as you described.

it works because you are not changing the length of the array
if you were changing the length of the array and you have two consecutive elements that would trigger the if statement, that wouldn’t really work as wished

the usual advice is do not mutate the array you are iterating over