August 1999
Intermediate to advanced
1488 pages
72h 53m
English
array.pop()
The pop() method "pops" elements off the end of the array by deleting the last element of the array and setting the array's length property to one less than its current value. This last element is returned from the method. Table 6.11 shows the return value associated with this method.
| Type | Item | Description |
|---|---|---|
| Returns | The last element in the array is returned from the method. |
In Listing 6.51, an array of pages is created to represent a stack of papers. The pop() method removes and returns the top-most paper. After the pop() method is executed, the variable currentPaper contains "Page3", and the ...
Read now
Unlock full access