Creating a Game Board


#1

I’m creating minesweepr and wrote the following code…

const printBoard = board => {

console.log('Currentboard');

console.log(board[0].join(’ | ‘));
console.log(board[1].join(’ | ‘));
console.log(board[2].join(’ | ‘));




const board = [
  [' ', ' ', ' '],
  [' ', ' ', ' '],
  [' ', ' ', ' ']
];

console.log(printBoard(board));

Unfortunately when i run the code it doesn’t run the code i want…

Current board:
| |
| |
| |

Can someone please tell me why?

Thanks


#2

missing } to close printBoard function


#3

And also, if your function prints the board, then what are you printing when you print the result of calling your function? You call console.log five times, pretty sure you only mean to print four things.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.