r/learnjavascript • u/xplodivity • Aug 23 '23
How to create a chessboard pattern using pure JavaScript (Interview question)
https://www.youtube.com/watch?v=fngnZch9l5M
0
Upvotes
1
u/Agarast Aug 23 '23
The nested if condition for the color can be simplified.
if(i%2 === j%2) //black
else //white
2
u/kap89 Aug 23 '23
That's not how the chessboard looks like.