MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / checkForGameOver

Function checkForGameOver

assets/js/2048.js:196–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers 1

generateFunction · 0.70

Calls 1

clearFunction · 0.70

Tested by

no test coverage detected