Created
August 25, 2015 19:32
-
-
Save kknights/da72c337616f4c673f1f to your computer and use it in GitHub Desktop.
EJ - Chessboard
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
// Chessboard | |
var size = 8; | |
for (var i = 0; i < size; i++) { | |
var row = ""; | |
for (var j = 0; j < size; j++) { | |
var total = i + j; | |
if (total % 2 == 0) { | |
row += '#'; | |
} else { | |
row += ' '; | |
} | |
} | |
console.log(row); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment