Sometimes Red, Sometimes Blue

In this project, we'll be making our own version of Sometimes Red, Sometimes Blue.


Open demo in full screen.

1. Use JavaScript (not CSS) to make the background color of the page red.


Open demo in full screen.

2. Use JavaScript to generate a random number from 1 to 2. Store its value in a variable.


Open demo in full screen.

3. If the number is 1, have the background be red.


Open demo in full screen.

4. If the number is 2, have the background be blue.


Open demo in full screen.

5. Get creative! You could try adding a third color, changing the text, or adding pictures depending on your random number.


Open demo in full screen.

6. When you're finished, submit your project below.