Skip to content

firstOr

firstOr(array, fallback)

Returns the first element of array, or fallback if the array is empty.

ts
firstOr([1, 2, 3, 4], 0); // 1
ts
pipe([1, 2, 3, 4], firstOr(0)); // 1