clean-jsdoc-theme TypeDoc APIv0.0.0

first

first<T>(array: T[]): T | undefined

Source: array.ts:415

Gets the first element of an array

Type Parameters

  • T — Array element type

Parameters

  • array (T[]) — The input array

Returns

  • T | undefined — First element or undefined

Example

CODE
first([1, 2, 3]) // 1
first([]) // undefined