if array value is the last value code example
Example: 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)
const colors = ['red', 'yellow', 'green', 'blue']
const lastItem = colors[colors.length - 1]
console.log(lastItem)