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