Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js take last item in array

const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #item #array
ADD COMMENT
Topic
Name
8+4 =