Created
May 28, 2015 00:31
-
-
Save Billboz/8183f7db201db69601db to your computer and use it in GitHub Desktop.
Eloquent Javascript Chapter 2 Chess Board Solution and Explanation
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
var board = ""; | |
for (var y = 0; y < size; y++) | |
{ | |
console.log("Inside the for-y loop and y is " + y); | |
for (var x = 0; x < size; x++) | |
{ | |
console.log("Inside the for-x loop and x is " + x); | |
if ((x + y) % 2 == 0) | |
board += " "; | |
else | |
board += "#"; | |
console.log("At the bottom of the for-x loop and x is " + x); | |
} | |
board += "\n"; | |
console.log("At bottom the for-y loop and y is " + y); | |
} | |
console.log(board); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment