getLast()function
getLast(items: PossibleArray<T>): T | undefined
| Param | Type | |
|---|---|---|
items | PossibleArray<T> | The array or iterable to read from. required |
| Return | |
|---|---|
T | undefined | The last item, or undefined if items is empty. |
Get the last item from an array or iterable, or undefined if it didn't exist.
Examples
getLast([1, 2, 3]) // 3