Array.pop
Array.pop
Function
Removes and returns the last element of the array.
Syntax
array.pop()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Any/Empty | Returns the deleted element if the array is not empty; returns Empty for an empty array. |
Example
items = [1, 2, 3] result = items.pop() // Output: 3 print result
Notes
- This method will modify the original array.