Array › first
Official
Returns the first element of the array.
Signature:
Returns: T | undefined — The first element of the array, or undefined if the array is empty.
Example:
console.log([1, 2, 3].first()); // 1
console.log([].first()); // undefined