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