Created
February 1, 2019 14:40
-
-
Save EvanGertis/f5ed9d8041df6b69d0622d385e8d4ddc to your computer and use it in GitHub Desktop.
This file contains 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
let body = document.getElementsByTagName("body"); | |
// global variables to set color | |
let color = ""; | |
let color_one = "red"; | |
let color_two = "black"; | |
// square size parameters. | |
let square_width = "100px"; | |
let square_height = "100px"; | |
// grid size parameters. | |
let rows = 6; | |
let cols = 6; | |
// main entry point for the program | |
main(); | |
function main(){ | |
// loop down the rows. | |
for(let i = 0; i < rows; i++){ | |
// container for the row. | |
let UI_body = UI_box(String(i)); | |
// loop across the columns. | |
for(let j = 0; j < cols; j++){ | |
if(j % 2 == 0 && i %2 == 0){ | |
color = color_one; | |
} | |
else { | |
color = color_two; | |
if(i % 2 != 0 && j % 2 != 0){ | |
color = color_one; | |
} | |
} | |
// generates a parameterized square and attaches it to the UI_box container. | |
square(UI_body, square_width, square_height, color); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment