Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let colors = ['red', 'green', 'blue', 'yellow', 'purple', 'black', 'white', 'orange'];
- let counter = 0;
- function changeBackgroundColor(){
- document.querySelector('body').style.backgroundColor = colors[counter];
- counter ++;
- if(counter >= colors.length-1)
- counter = 0;
- }
- setInterval(changeBackgroundColor, 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement