So I'm relatively new to javascript and I'm trying to do a chess board for two players. I'm designing the board and I wanted to add the numbers and letters on the side and below the board, so I created a Rect under the the board and on the right side. I managed to place the numbers on the right side but when I tried to do it under the board the whole variable just stays together and not spread out. I tried different things already like changing from 'i' to 'j' and even the location but nothing worked I'm new on the whole coding things so if you would like to know more about the code and what I did just ask
Here is the code:
var ctx = document.getElementById('canvas1').getContext('2d');
var x = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
var y = ['1', '2', '3', '4', '5', '6', '7', '8'];
for(var i = 0; i < 8; i++){
for(var j = 0; j < 8; j++){
if( (i+j) % 2 == 0){
color = 'black';
}
else{
color = 'white';
}
ctx.fillStyle = color;
ctx.fillRect( 20 + i*80, 20 + j*80, 80, 80 );
ctx.fillText( x [i], 70, 685, + i*80);
};
ctx.font = '30px helvetica';
ctx.fillStyle = 'black';
ctx.fillText( y [i], 667.5, 70 + i*80);