Get the last element of an array in TypeScript
There are a few ways you can get the last element of an array in typescript
Given an array
const arr: string[] = ['one','two','three'];
Using Splice
const lastVal = arr.splice(-1)[0];
Using length
const lastVal = arr[arr.length - 1];