how to print the last element of an array code example
Example 1: how to print the last element of an array
var array = [1,2,3,4,5];
var last_element = array[array.length - 1];
console.log(last_element); //Expected Output: 5
Example 2: find last element in array in java
firstNum = numbers.get(0);
lastNum = numbers.get(numbers.size() - 1);