find last element in array in javascript code example
Example 1: get last element of array javascript
let colors = ["red", "yellow", "green"];
let lastELement = colors[colors.length - 1]
Example 2: last element of an array
int[] array = {1,2,3};
System.out.println(array[array.length - 1]);