I'm building a minesweeper and the team give me the UI and I can't modify it, I've write this code, the first step that I took was create the "empty board", this one has no mines because when I tried to put the mines into it when I reload the page the mines shows up at first.
Now, I code a function that gives me random mines following the board size but now I need to compare when the user clicks on a tile is or not a mine, I tried this conditional into the function onClick (the function works well)
When I print the board in console it returns this:
Board

note: -1 is a state that UI provides me
And this is the function that returns the mines position:
This is the output from minePosition:

this array of arrays gives me the mines position
Here is the condition that I tried to build but it doesn't work
let grid = boardWithoutMines(boardSize, minesInGame);
const minePosition = getMinePositions(boardSize, minesInGame);
export function onClick(position: [number, number]) {
if (minePosition.some(grid[0][1])) {
grid[position[0]][position[1]] = CellEnum.Mine
} else {
grid[position[0]][position[1]] = CellEnum.Cero
}
setGrid(grid);
}
Ignore the setGrid(grid) at the end, this functions just render the click