Answers for "how to take the last item off and array js"

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
1

last item in array javascript

// Find the last item in an array.
arrayName[arrayName.length - 1]
Posted by: Guest on September-16-2020

Code answers related to "how to take the last item off and array js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language