You’re right in thinking it adds an element to the array, however it doesn’t return the array, it just returns the length of the new array which is a number
The following line is not doing what you think it is.
var array = arr.push(item);
The push method has a return value and the value return from it is a number representing the new length of the array after the push is executed. So, your code above pushes the item onto the end of arr, but assigns the value 6 to array. Then you attempt to use the shift function on array, but since array is just a number, your code errors out.
EDIT:@gebulmer We both responded at the same time with the same explanation.