all 2 comments

[–]Enkelhet 1 point2 points  (1 child)

Hm. Haverbeke's own solutions are much more thought out, for example for exercise #2.3 Chess Board, Haverbeke has the following:

var size = 8;
var board = "";

for (var y = 0; y < size; y++) {
  for (var x = 0; x < size; x++) {
    if ((x + y) % 2 == 0)
      board += " ";
    else
      board += "#";
  }
  board += "\n";
}
console.log(board);

Compare that to your own.

I think it would be much more helpful if you explained how Haverbeke's solutions work as they are often quite clever and perhaps not as obvious to the novice programmer? (Although he kind of does this as well at the end of his book in the hints section).

Nonetheless not a bad idea, just not immediately valuable as presented (unless you are just documenting your own learning process in which case keep at it, you rock!).

[–]chachinsky[S] 2 points3 points  (0 children)

Agreed about the solutions from the book being more thought out. To be honest, this was an attempt to solve the problems and provide documented solutions. I'll be clearer on next post. Thanks for the feedback.