From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Array Object
The pop() method is used to remove and return the last element of an array.
| arrayObject.pop() |
Note: This method changes the length of the array.
Tip: To remove and return the first element of an array, use the shift() method.
ExampleIn this example we will create an array, and then remove the last 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)