Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check the last item in an array javascript

const colors = ['red', 'yellow', 'green', 'blue']
const lastItem = colors[colors.length - 1]
console.log(lastItem)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #item #array #javascript
ADD COMMENT
Topic
Name
1+8 =