Array.last
Array.last
Function
Returns the last element of the array.
Syntax
array.last()
Parameters
None.
Return value
| Type | Description |
|---|---|
| Any | The last element; an empty array returns empty. |
Code Example
result = [1, 2, 3].last() // Output: 3 print result
Notes
- The original array is not modified.