last
arrayGets the last element of array.
Signature
last<T>(array: T[]): T | undefinedParameters
| Name | Type | Description |
|---|---|---|
array | T[] | The array to query |
Returns
T | undefined - Returns the last element of array
Examples
Basic usage
import { last } from 'dashlite'
const result = last([1, 2, 3])
console.log(result)Output:
3Available since version 1.0.0