Answers for "javascipt get last element of array"

25

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
5

javascipt get last element of array

const arr = [1,2,3] ;
console.log(arr[arr.length - 1]);
Posted by: Guest on June-18-2020
5

find last element in array javascript

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

Code answers related to "javascipt get last element of array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language