return a chest board array code example
Example: return a chest board array
function chessBoard(rows, columns) {
let board = [];
for(let i = 0; i < rows; i++)
{
let col = [];
for(let j = 0; j < columns; j++)
{
if(i % 2 == 0)
{
j % 2 == 0 ? col.push("O") : col.push("X");
}
else
{
j % 2 == 0 ? col.push("X") : col.push("O");
}
}
board.push(col);
}
return board;
}