Clean up code
This commit is contained in:
parent
cc2571dd50
commit
b4968f443c
1 changed files with 7 additions and 5 deletions
12
script.js
12
script.js
|
|
@ -25,7 +25,7 @@ let isWhite;
|
|||
let isErase;
|
||||
|
||||
|
||||
getGridDimensions();
|
||||
resetGrid();
|
||||
|
||||
buttons.forEach((button) => {
|
||||
button.addEventListener ("click", changeColor);
|
||||
|
|
@ -43,19 +43,21 @@ function pickBackground() {
|
|||
|
||||
function resetGrid() {
|
||||
gridSlider.value = gridSlider.defaultValue;
|
||||
getGridDimensions();
|
||||
}
|
||||
|
||||
function getGridDimensions() {
|
||||
container.style.backgroundColor = "#ffffff";
|
||||
backColorPicker.value = "#ffffff";
|
||||
colorPicker.value = "#000000";
|
||||
colorValue = "black";
|
||||
|
||||
getGridDimensions();
|
||||
}
|
||||
|
||||
function getGridDimensions() {
|
||||
numGrid = gridSlider.value;
|
||||
|
||||
while (container.firstChild) {
|
||||
container.removeChild(container.lastChild);
|
||||
}
|
||||
|
||||
createGrid();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue