function last
last(value: string): string | undefined

Returns the last thing in a list. If the value is a string, then it will return the last character.

Examples

Example 1

last("hello"); // "o"
last([1, 2, 3]); // 3
last([]); // undefined

Parameters

value: string

Return Type

string | undefined
last<T>(list: T[]): T | undefined

Type Parameters

Parameters

list: T[]

Return Type

T | undefined