js get array of last element code example
Example 1: js array last element get
.slice(-1)[0]
Example 2: last index of array js
array.lastIndexOf(searchElement[, fromIndex]);
.slice(-1)[0]
array.lastIndexOf(searchElement[, fromIndex]);