last element in a n array code example
Example 1: last element of array javascript
var my_array = /* some array here */;
var last_element = my_array[my_array.length - 1];
Example 2: how to get last element of an array in swifg
let myArray = ["Hello!", "World!"]
let capacity = myArray.count
let lastElement = myArray[capacity-1]
print(lastElement)