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,]=arr>x>pivot?right.push(x):left.push(x))
        return Quick(left).concat(pivot).concat(Quick(right))


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

        const [pivot,]=arr