diff --git a/src/index.js b/src/index.js index 575878b..949e4aa 100644 --- a/src/index.js +++ b/src/index.js @@ -62,7 +62,7 @@ function isKing(piece) { function imageFromPiece(piece) { if (piece) { - let image = piece.color === WHITE ? piece.type : piece.type + 6; + const image = piece.color === WHITE ? piece.type : piece.type + 6; return Images[image]; } return null; @@ -88,7 +88,6 @@ class Piece { this.color = color; this.type = type; } - } class Board extends React.Component { @@ -133,11 +132,12 @@ class Board extends React.Component { new Piece(BLACK, KNIGHT), new Piece(BLACK, ROOK) ]; - let squares = whiteRow; - squares = squares.concat(Array(8).fill(new Piece(WHITE, PAWN))); - squares = squares.concat(Array(32).fill(null)); - squares = squares.concat(Array(8).fill(new Piece(BLACK, PAWN))); - squares = squares.concat(blackRow); + let squares = whiteRow.concat( + Array(8).fill(new Piece(WHITE, PAWN)), + Array(32).fill(null), + Array(8).fill(new Piece(BLACK, PAWN)), + blackRow); + return squares; }