Here is my code.
/*eslint-env es6*/
const button = document.querySelector('button')
const body = document.querySelector('body')
const colors = getRandomColor()
body.style.backgroundColor = 'violet'
button.addEventListener('click', changeBackground)
function changeBackground(){
const colorIndex= parseInt(Math.random(colors.length))
body.style.backgroundColor = colors[colorIndex]
}
I keep getting the message of ERROR: ‘getRandomColor’ is not defined. [no-undef]. I’m not sure what this means? I thought I defined it by setting the const. Maybe it just isn’t working with my code? Any ideas?