快速排序算法中,使用splice操作数组没问题,使用push出错

直接上代码

            var a= [51,23,45,78,21,79,65,62,7,48]
            function quickSort(a) {
                if(a.length <= 1) {
                    return a;
                }
                let left = [],right = [],temp = [];
                key = Math.floor(a.length / 2);
//              temp.push(a[key]);    
                temp = a.splice(key, 1);
                for(var i = 0; i < a.length; i++) {
                    temp>a[i]?left.push(a[i]):right.push(a[i]);
                }
                return quickSort(left).concat(temp, quickSort(right));
            }
            console.log(quickSort(a));

当使用temp = a.splice(key, 1);排序算法没问题可得到预期结果。
当使用temp.push(a[key]);,控制台提示的报错信息是堆栈溢出(Maximum call stack size exceeded)
将这两个值打出来你会发现,这两个值一模一样...
路过的大神们,求解...

temp = a.splice(key, 1);会把a列表删除一个元素并返回给temp;
temp.push(a[key]);只是在temp中添加一个元素,a并没变