take the last in array js code example
Example 1: javascript get last element of array
var name = ["jon","tem","kevin", "ramos"];
var lastNameInArray = name[name.length - 1];// >> ramos
Example 2: how to find last element in array
int [] y={1,2,3,4,5};
int c=(n.length-1);