[basic] chessBoard author solution

main
Vasily Guzov 1 year ago
parent 10ad87d9a4
commit 44ec6f1f8f

@ -21,4 +21,21 @@ function chessBoard(size: number) {
console.log(output)
}
chessBoard(8);
function chessBoardAthorSolution(size: number) {
let board = "";
for (let y = 0; y < size; y++) {
for (let x = 0; x < size; x++) {
if ((x + y) % 2 == 0)
board += " ";
else
board += "#";
}
board += "\n";
}
console.log(board)
}
chessBoardAthorSolution(10);

Loading…
Cancel
Save