const arr: string[] = ['a', 'b', 'c'];
V1
const last = arr.at(-1);
console.log(last); // -> "c"
V2
const last = arr[arr.length - 1];
console.log(last); // -> "c"
V3
If you don't need the array afterwards, you could use
const last = arr.pop()
console.log(last); // > "c"
V4
const last = arr.slice(-1)[0]
console.log(last); // -> "c"
var items: String[] = ["tom", "jeff", "sam"];
alert(items[items.length-1])
const cars = ["benz", "bmw", "volvo", "skoda"];
const lastThree = cars.slice(-3);
console.log(lastThree); // ["bmw", "volvo", "skoda"]