From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Array Object
The shift() method is used to remove and return the first element of an array.
| arrayObject.shift() |
Note: This method changes the length of the array.
Tip: To remove and return the last element of an array, use the pop() method.
ExampleIn this example we will create an array, and then remove the first element of the array. Note that this will also change the length of the array:
The output of the code above will be:
Try it yourself » |
JavaScript Array Object
From http://www.w3schools.com (Copyright Refsnes Data)