The player must correctly guess the correct color by clicking on the colored squares on the page. The page has already been built, but you have to complete the JavaScript to make it work!
Complete the JavaScript to make the game work, for example;
-
By adding event listeners to the buttons
-
Adding the missing game logic
-
The HTML and CSS have already been prepared for you. Do not edit these files.
-
Write your code in script.js
- The computer must create new random colors for all squares on the page
- One of those random colors must be the correct color
- The RBG value of the correct color must be set in the element
#color-display. This will provide a clue to the player.
- The button New Colors must create new random colors for all squares on the page
- The button Easy must set the number of colored squares to 3
- The button Hard must se the number of colored squares to 6
- If they clicked on the correct color;
- set the text in the
#messageelement toCORRECT
- set the text in the
- If they clicked on the wrong color;
- set the text in the
#messageelement toTRY AGAIN - set the color of the colored square to the background color (making it look invisible)
- set the text in the
