()
| 202 | |
| 203 | //check for win |
| 204 | function checkForWin() { |
| 205 | let matches = 0; |
| 206 | |
| 207 | for (let count = 0; count < squares.length; count++) { |
| 208 | if ( |
| 209 | squares[count].classList.contains("flag") && |
| 210 | squares[count].classList.contains("bomb") |
| 211 | ) { |
| 212 | matches++; |
| 213 | } |
| 214 | if (matches === numBombs) { |
| 215 | result.innerHTML = "YOU WIN!"; |
| 216 | isGameOver = true; |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | }); |