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