js detect if last element in array is equal last element in another array code example Example: last element from list javascript const lastItem = colors[colors.length - 1]