This code is supposed to show a chessboard of 8\*8 size and it works fine when I use `document.write` but it doesn't show the same output with `console.log`. Can someone please explain.

```js
window.onload = function() {
  var hash = '#';
  var size = 8;
  for (var i = 0; i < size; i++) {
    for (var j = 0; j < size; j++) {
      if ((i + j) % 2 === 0) {
        document.write("\xa0");
      } else {
        document.write(hash);
      }
    }
    document.write("<br>");
  }
}
```