const myOldArr = [2, 3, 6];
const newArr = myOldArr.pop().shift();
Why does doing this give me a TypeError? Is there a way to do this without a loop? I want the new array to be stored inside a variable so the remaining numbers that don't get removed are stored inside an array of some sort.