Created
March 19, 2019 23:07
-
-
Save marsrvr/a349677f0d232a8c29f04faff2b822e2 to your computer and use it in GitHub Desktop.
IvanOnTech Academy Smart Contract Programming Elegant JavaScript Chapter 2, Exercise 3
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
function chessboard() { | |
var rankstr = undefined; | |
for (var row = 1; row <= 8; row ++) { | |
rankstr = ''; | |
for (var col = 1; col <= 8; col ++){ | |
if ((row + col) % 2 == 0) { | |
rankstr += '.'; | |
} else { | |
rankstr += '#'; | |
} // switch colors | |
} // traverse cols | |
console.log(rankstr) | |
} // traverse rows | |
return 'done.' | |
} // chessboard() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment