From e59e1a68f5c0d3f5fbef9868f244e5e6004ae4f2 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Tue, 29 Dec 2020 16:55:35 -0500 Subject: [PATCH] A bit of reset() cleanup --- src/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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; }