raganwald / allong.es

https://leanpub.com/javascriptallongesix
484 stars 28 forks source link

wrong order of operations in Game example #18

Open jorda0mega opened 10 years ago

jorda0mega commented 10 years ago

on page 210 a game is initialized with the following:

this.size = size ? Math.floor(Math.random() * 8) + 8 : size;

however, if size is null it is trying to create Game with null size. Therefore, the code should read like this:

this.size = size ? size : Math.floor(Math.random() * 8) + 8;