javascript chessboard grid

Solutions on MaxInterview for javascript chessboard grid by the best coders in the world

showing results for - "javascript chessboard grid"
Alessandra
14 Nov 2019
1 size = 10; 
2    
3    grid = ""
4    
5    for (var i = 1; i <= size; i++) {
6      for (var j = 1; j <= size; j++) {
7        if (i % 2 === 0) {
8        	grid+= "# "
9        } else {
10        	grid+= " #"
11        }
12      }
13      grid+= "\n"
14    }
15    
16    
17    console.log(grid)