so im working on a function or a solution for this problem but im still a junior. this is the provided array, [javascript] **
[
[0, 9, 0, 0],
[0, 0, 9, 0],
[0, 9, 0, 9],
[9, 9, 0, 0],
]
new
[1, 9, 2, 1],
[2, 3, 9, 2],
[3, 9, 4, 9],
[9, 9, 3, 1],
]
**
im starting a minesweeper project, the zeros are empty spaces , the 9's are mines, i need to change the zeros to the number of adjacent mines, i couldnt find a simple solution that i could understand , so if someone can provide a simple solution i would appreciate it.
i thought about getting the coordinates
[x-1][y-1], [x][y-1] [x] [y+1]
etc.. for each index but the thing is not every index has these coordinates. help plz