clean-jsdoc-theme TypeDoc APIv0.0.0

last

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

Source: array.ts:434

Gets the last element of an array

Type Parameters

  • T — Array element type

Parameters

  • array (T[]) — The input array

Returns

  • T | undefined — Last element or undefined

Example

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