Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
How can I verify if a tuple into an array matches with other tuple in another array?

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 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 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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!