I am building a connect 4 app in react. While checking the condition for a draw(tie), I am not able to loop through the array built with Fill Function (7 by 6) array.
state = {
columnGrid: new Array(7)
.fill(0)
.map(() => new Array(6).fill(null)),
}
const test = this.state.columnGrid.slice();
Result of console.log(test):
(7) [Array(6), Array(6), Array(6), Array(6), Array(6), Array(6),
Array(6)]
0: (6) [null, null, null, null, null, null]
1: (6) [null, null, null, null, null, null]
2: (6) [null, null, null, null, null, null]
3: (6) [null, null, null, null, null, null]
4: (6) [null, null, null, null, null, null]
5: (6) [null, null, null, null, null, null]
6: (6) ["/static/media/golden.d6314cc9.png", null, null, null, null,
null]
I need to loop through all the arrays and check for the condition whether the array!== null