title: How do I solve the Eloquent Javascript "Chess Board"?
body: <p>new coder here trying to learn JS. I did codecademy already and am working through Eloquent Javascript now. I finally got something together after scratching my head for a very long while... but it doesn't work! I'm not quite sure if I'm approaching this from the right angle but I do know I want to use the loops to track progress through the printing of the # based grid.</p>
  
  <blockquote>
    <p>Write a program that creates a string that represents an 8×8 grid,
    using newline characters to separate lines. At each position of the
    grid there is either a space or a “#” character. The characters should
    form a chess board.
    Passing this string to console.log should show something like this:</p>
  </blockquote>
  
  <pre><code> # # # #
  # # # # 
   # # # #
  # # # # 
   # # # #
  # # # # 
  </code></pre>
  
  <p><strong><em>My code is below:</em></strong></p>
  
  <pre><code>    var chessBoard = "";
      var size = 8;
  
      for (var lineCounter = 1; lineCounter &lt; size; lineCounter++) { 
  
          if (lineCounter%2 === 0) { /
  
  /if lineCounter is an even number
          for (var charCounter = 1; charCounter &lt; size; charCounter++) {
              var evenOdd = (charCounter%2 === 0);
              switch (evenOdd) {
                  case true:
                      (chessBoard += "#");
                      break;
                  case false:
                      (chessBoard += " ");
                      break;
                  }
              }                   
          }
      else { //if lineCounter is an odd number
          for (var charCounter = 1; charCounter &lt; size; charCounter++) {
              var evenOdd = (charCounter%2 === 0);
              switch (evenOdd) {
                  case true:
                      (chessBoard += " ");
                      break;
                  case false:
                      (chessBoard += "#");
                      break;
              }
              }                       
          }   
      chessBoard += "\n";
      }
      console.log(chessBoard);
  </code></pre>
  
  <p>The current output of the program is this:</p>
  
  <pre><code># # # #
   # # # 
  # # # #
   # # # 
  # # # #
   # # # 
  # # # #
  </code></pre>
  
  <p>Through some iterations, I've already learned a lot, but right now I already see an error - I'm clearly down to a 7x7 grid instead of the 8x8 I wanted to get. I suspect it has to do with me using "&lt;" in my for loops, but not sure if there's a better way to tackle this instead of just adding an extra digit. </p>