Making a quicksort function using stack and the first element as pivot

hey guys im making a quicksort function using stack, and i could implement it with the pivot to be the middle most element but now i want to change it to make it work when the first element is the pivot
this is my code

I dont know about the language your using, but here is simple implementation in my language, maybe it help you:

const Quick=(arr)=>{
    if (arr.length<=1||!arr){
        return arr
    } else {
        const right=[];
        const left=[];
        const [pivot,...rest]=arr
        rest.map(x=>x>pivot?right.push(x):left.push(x))
        return Quick(left).concat(pivot).concat(Quick(right))
    }
}

Quick([-1,4,50,32.4,25,29,30])

Yes, it will be the first element in each of the subarrays in each call:

        const [pivot,...rest]=arr