typescript last element of list code example
Example 1: how to get last element of array in typescript
var items: String[] = ["tom", "jeff", "sam"];
alert(items[items.length-1])
Example 2: last element from list javascript
const lastItem = colors[colors.length - 1]