]> git.cworth.org Git - empires-server/commitdiff
tictactoe: Use empty strings instead of null objects for empty squares
authorCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 14:25:53 +0000 (07:25 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 14:25:53 +0000 (07:25 -0700)
So that the data in the board array is always of a consistent type.

tictactoe.js

index 1f559bde50c1a91be83cd2847d6d6cefe990650b..f9b357bf3202dfbc84443818dbd3626958e5f307 100644 (file)
@@ -7,7 +7,7 @@ class TicTacToe extends Game {
   constructor(id) {
     super(id);
     this.moves = [];
-    this.board = Array(9).fill(null);
+    this.board = Array(9).fill("");
   }
 
   /* Returns Boolean indicating whether move was legal and added. */