Remove Last
Removes the last element of an array.
| Category | Arrays |
| Author | Pol Gubau |
| Since | 1.0.0 |
| Last Updated | 2025-03-15 |
| Type | Sync |
| Compatibility | Universal |
Example
Input
removeLast([1, 2, 3])Output:
[1, 2]
Return
A new array without the last element.
Type: array
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| arr | T[] | null | Yes | The array from which to remove the last element. |
Notes
The original array is not mutated.
Tags
- array
- remove
- last
- element