Published
- 1 min read
javascript get last element of array
The solution for this is noted below
javascript get last element of array
Solution
var foods = ['kiwi', 'apple', 'banana']
var banana = foods[foods.length - 1] // Getting last element
Try other methods by searching on the site. That is if this doesn’t work