Skip to content

Commit a53df89

Browse files
author
José Costa
committed
Corrected bugs
1 parent db667b7 commit a53df89

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ This repository will only be updated once in a while.
88

99
* (mar. 10th 2019) Creation of the repository
1010

11-
* (june 16th 2019) Updated with stuff I've done since the previous update
11+
* (june 16th 2019) Updated with stuff I've done since the previous update
12+
13+
### External references:
14+
15+
* Colored Grid demo: https://codepen.io/ze1598/full/EBKWwO

examples/colored-grid/script.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ for (let i=0; i<49; i++) {
1010
const redPickButton = document.getElementById("red-button")
1111
const greenPickButton = document.getElementById("green-button")
1212
const bluePickButton = document.getElementById("blue-button")
13+
const defaultPickButton = document.getElementById("undefined-button")
1314
const boardSquares = Array.from(document.getElementsByClassName("board-item"))
1415
const resetButton = document.getElementById("reset-button")
1516

1617
const colorOptions = ["red", "green", "blue"]
1718
let chosenColor
1819

1920
// Add event listeners to handle color choices
20-
[redPickButton, greenPickButton, bluePickButton].forEach(colorBtn => {
21+
[redPickButton, greenPickButton, bluePickButton, defaultPickButton].forEach(colorBtn => {
2122
colorBtn.addEventListener("click", chooseColor)
2223
})
2324
// Reset the board colors button
@@ -45,6 +46,9 @@ function chooseColor() {
4546
case "blue-button":
4647
chosenColor = "blue"
4748
break;
49+
default:
50+
chosenColor = "undefined"
51+
break;
4852
}
4953
}
5054

0 commit comments

Comments
 (0)