Published
- 1 min read
js take last item in array
The solution for this is noted below
js take last item in array
Solution
const heroes = ['Batman', 'Superman', 'Hulk']
const lastHero = heroes.pop() // Returns last elment of the Array
// lastHero = "Hulk"
Try other methods by searching on the site. That is if this doesn’t work