Answers for "how to find last item in array js"

26

js take last item in array

const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"
Posted by: Guest on March-16-2020
-1

how to find last element in array

int [] y={1,2,3,4,5};
int c=(n.length-1);
Posted by: Guest on September-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language