How to Get the Last Element of an Array in JavaScript | Built In
There are several ways to get the last element of a JavaScript array, including length property and square bracket notation, slice() method and pop() method. Here are nine methods to try.
builtin.com