()
| 194 | |
| 195 | //check if there are no zeros on the board to lose |
| 196 | function checkForGameOver() { |
| 197 | let zeros = 0 |
| 198 | for (let i = 0; i < boxes.length; i++) { |
| 199 | if (boxes[i].innerHTML == 0) { |
| 200 | zeros++ |
| 201 | } |
| 202 | } |
| 203 | if (zeros === 0) { |
| 204 | resultDisplay.innerHTML = 'You LOSE' |
| 205 | document.removeEventListener('keyup', control) |
| 206 | setTimeout(() => clear(), 3000) |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | //clear timer |
| 211 | function clear() { |