Token Error: Colors

Here is my code

/*eslint-env es6*/
const button = document.querySelector('button')
const body = document.querySelector('body')
const colors = getRandomColor() = 'violet'
button.addEventListener('click', changeBackground)

function changeBackground(){
const colorIndex= parseInt(Math.random()colors.length) = colors[colorIndex]

I keep getting the message of ERROR: Parsing error: Unexpected token colors. I don’t know exactly what I’m doing wrong or how to fix it, I’ve tried many other sources to try and solve the issue but I can’t find any solution. Any ideas?

You have a syntax error here. Should it be Math.random(colors.length)?

1 Like

Thank you so much! It worked perfectly :slight_smile: