The first array element itself is deleted, not just its value: the original array's second element becomes the first element of the modified array, and the array size (length) has decreased by one.
Related array method:
The unshift() method inserts an array element at the first position, pushing down other elements.
Using the shift() Method
var arlene = new Array("delta", "alpha", "beta", "gamma");
// Show shift()'s return value and modified array size
alert( arlene.shift() +"\n"+ arlene.length );
Our modified array's length of 3 confirms that the operation was successful, and that shift() did in fact remove an element. The first array element ("delta") was in fact removed, and its value was returned.
Because the shift() method returns the array element it deleted, shift() has a return value of variable data type.
Make sure you scripts handle it appropriately, with type conversion methods if needed (the
toString() methods, for example).
Test the shift() Method