Optimizing the Lookup Function

An Inelegant Solution This is the current chip lookup function in BitNGo: 1 2 3 4 5 6 7 8 9 10 11 function check_boards(ltr, nm) //puts chips in played numbers { for (i= 0 ; i<boards.length; i++) //checks each board { if (boards[i][ltr].includes(nm)) //if it includes the number... { boards[i][ltr][boards[i][ltr].indexOf(nm)] = "X" ; //it marks it as "X" } } console.table(boards[ 0 ]); } This is a terrible solution because in it, we check every board in game. Let's say we have 8 boards playing, and only 2 of them contain the number that has been played. With this function, we would be unnecessarily, checking every board in the game. To avoid this, I have come up with the idea of indexing every board into an array, that way, we know which boards to look for. The idea came to me a couple of days ago, but it was today in Anatomy class that I decided to start working in the concept....