I've got this problem. My function seems to check outside the borders of my 10x10 board. It's made to return the number of mines around a Tile[row, column] but I get :
minesweeper.js:152 Uncaught TypeError: Cannot read property '0' of undefined
at getAdjacentMines (minesweeper.js:152)
Here is my function, thanks everyone for your time.
function getAdjacentMines(row, col) {
let count = 0;
let minRow = row - 1;
let maxRow = row + 1;
let minCol = col - 1;
let maxCol = col + 1;
if (minRow < 0) minRow = 0;
if (maxRow > board.length) maxRow = board.length - 1;
if (minCol < 0) minCol = 0;
if (maxCol > board.length) maxCol = board.length - 1;
for (row = minRow; row <= maxRow; row++) {
for (col = minCol; col <= maxCol; row++) {
if (board[row][col].boom === true) count++;
}
}
return count;
}