javascript last item in nodelist code example
Example 1: last element from list javascript
const lastItem = colors[colors.length - 1]
Example 2: javascript last in a list
let list = ["item1", "item2", "item3", "etc"];
let last = list.reverse()[0]
// or
let last = list[list.length - 1]
// or
let last = list.slice(-1)