Documentation
last

last

Gets the last element of the wrapped array if one exists, otherwise null.

import { arr } from '@tsly/arr';
 
const fruit = ["pear", "banana", "orange"];
console.log(arr(fruit).last);
// "orange"
 
const empty = [];
console.log(arr(empty).last);
// null

Edit on CodeSandbox (opens in a new tab)