head

Returns the first value of an array. Throws an Error if the array is empty.

Type

type head = <E>(s: Array<E>) => E

Example

import {head} from 'fnxt/array';

const array = [2, 3, 4];
head(array) // -> 2

See Also

|  head  |              tail              |
|---[0]-----[1]-----[2]-----[3]-----[4]---|
|              init              |  last  |