javascript how to know property of last element in array code example
Example 1: js take last item in array
const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"
Example 2: how to select last element in a array
int[] karunakar={1,2,3};
System.out.println(karunakar[karunakar.length-1]);