title: This code is not working with console.log but working fine with document.write
body: <p>This code is supposed to show a chessboard of 8*8 size and it works fine when I use <code>document.write</code> but it doesn't show the same output with <code>console.log</code>. Can someone please explain.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>window.onload = function() {
    var hash = '#';
    var size = 8;
    for (var i = 0; i &lt; size; i++) {
      for (var j = 0; j &lt; size; j++) {
        if ((i + j) % 2 === 0) {
          document.write("\xa0");
        } else {
          document.write(hash);
        }
      }
      document.write("&lt;br&gt;");
    }
  }</code></pre>
  </div>
  </div>
  </p>