If the array is empty, `first` and `last` return undefined, but their type signatures say that they return an array item. (This could be considered a breaking change.)
If the array is empty,
firstandlastreturn undefined, but their type signatures say that they return an array item.(This could be considered a breaking change.)