Skip to content

Instantly share code, notes, and snippets.

@harryadel
Last active August 26, 2016 19:12
Show Gist options
  • Save harryadel/953788d8885091219dcf7ab48fbc358e to your computer and use it in GitHub Desktop.
Save harryadel/953788d8885091219dcf7ab48fbc358e to your computer and use it in GitHub Desktop.
/*
My answer for exercise 'Chess board'
in Eloquent JavaScript Second Edition
Chapter 2 Program Structure
*/
var oddRow = "# # # #";
var evenRow = " # # # #";
for (var i = 1; i < 9; i++) {
if (i % 2 == 0) {
console.log(evenRow);
}else {
console.log(oddRow);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment