Answers for "check if last element of array javascript"

0

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)
Posted by: Guest on February-01-2021

Code answers related to "check if last element of array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language