Skip to content

Instantly share code, notes, and snippets.

@neur0manc
Created June 19, 2019 07:46
Show Gist options
  • Save neur0manc/34591ad2c98a7d12e45c859f15e166a9 to your computer and use it in GitHub Desktop.
Save neur0manc/34591ad2c98a7d12e45c859f15e166a9 to your computer and use it in GitHub Desktop.
Eloquent JavasScript Rev.3 :: Chapter 2 :: Checkerboard Exercise
const size = 8
let output = ""
let currentChar = "#"
for (let _ = 1; _ <= size; _ += 1) {
let line = ""
currentChar = currentChar === "#" ? " " : "#"
for (let __ = 1; __ <= size; __ += 1) {
line += currentChar
currentChar = currentChar === "#" ? " " : "#"
}
output += `${line}\n`
}
console.log(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment