I\'m trying to make a webpage change the background color every one second using JavaScript. I\'m using setTimeout but I can\'t figure out how to get my variabl
setTimeout
For one thing, this:
if (x = 1){
Should be this:
if(x == 1) {
Your statement sets x to 1, rather than tests it to see if it's 1.