js take last element code example
Example 1: javascipt get last element of array
const arr = [1,2,3] ;
console.log(arr[arr.length - 1]);
Example 2: how to select last element in a array
int[] karunakar={1,2,3};
System.out.println(karunakar[karunakar.length-1]);