From: Carl Worth Date: Sat, 20 Jun 2020 17:21:32 +0000 (-0700) Subject: Use an array spread syntax instead of .fill(null) X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=commitdiff_plain;h=e7e45fef427d3d76f7f88ca919c73e28de5a301b;hp=bc101387edcc19bf11d69d662b5ff46134795e3a Use an array spread syntax instead of .fill(null) I don't really need null items. In fact, the copy here with the appray spread syntax gives undefined, not null items. All I need is items that map() will actually act on. The initial Array(9) gives only "empty" items which map() ignores. --- diff --git a/scribe/scribe.jsx b/scribe/scribe.jsx index be0de37..7815594 100644 --- a/scribe/scribe.jsx +++ b/scribe/scribe.jsx @@ -268,7 +268,7 @@ class Game extends React.Component { game_info: {}, player_info: {}, other_players: [], - squares: Array(9).fill(null).map(() => Array(9).fill(null)), + squares: [...Array(9)].map(() => Array(9).fill(null)), moves: 0, next_to_play: "+" };