Created
July 29, 2015 14:53
-
-
Save amadden80/7dd7a725958354fe0f16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Write a function that changes the background color of a website | |
| function changeBackground(){ | |
| // 2. Write an array of color strings | |
| var colors = ['red', 'green', 'orange', 'purple', 'blue']; | |
| // 3. Have your color change function randomly select one of the colors from that array | |
| var colorChoice = colors[ Math.floor( Math.random() * colors.length ) ]; | |
| document.body.style.backgroundColor = colorChoice; | |
| } | |
| setInterval( changeBackground, 100 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment