Last active
September 9, 2015 07:00
-
-
Save harunyasar/5e755ea3c67f74ff14c6 to your computer and use it in GitHub Desktop.
Simple grid creator...
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 createGrid = function (rows, cols) { | |
var str = "", | |
odd = "o", | |
even = "#"; | |
for (var row = 0; row < rows; row++) { | |
for (var col = 0; col < cols; col++) { | |
if ((row + col) % 2 === 0) { | |
str += even; | |
} else { | |
str += odd; | |
} | |
} | |
str = ""; | |
} | |
}; | |
createGrid(8, 8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment