9.1.6 Checkerboard V1 Codehs Now
Always declare loop variables using var (e.g., for (var r = 0; ...) ). Forgetting var can leak the variable into global scope, breaking the nested loop logic.
// 2. Determine color based on row + col sum if((row + col) % 2 == 0) 9.1.6 checkerboard v1 codehs
print_board(board)
: If the sum of the current row index ( r ) and column index ( c ) is divisible by 2, it colors the square black . Always declare loop variables using var (e