const animals = [‘cat’, ‘dog’, ‘horse’]
// before
const lastItem = animals[animals.length - 1]
// ES2022
const lastItem = animals.at(-1)
const animals = [‘cat’, ‘dog’, ‘horse’]
// before
const lastItem = animals[animals.length - 1]
// ES2022
const lastItem = animals.at(-1)