Skip to content

Instantly share code, notes, and snippets.

@harunyasar
Last active September 9, 2015 07:00
Show Gist options
  • Save harunyasar/5e755ea3c67f74ff14c6 to your computer and use it in GitHub Desktop.
Save harunyasar/5e755ea3c67f74ff14c6 to your computer and use it in GitHub Desktop.
Simple grid creator...
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