From a634c8e7bf7eacbb189bd08fda957dfb14ec8461 Mon Sep 17 00:00:00 2001 From: Jarvis-3000 <57852939+Jarvis-3000@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:25:15 +0530 Subject: [PATCH] Preventing from clicking on any key. I have added a removeEventListener in gameOver function, so after ending the game it will prevent to make changes in the game. --- app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index c1bfb48..a3e1d24 100644 --- a/app.js +++ b/app.js @@ -245,7 +245,8 @@ document.addEventListener('DOMContentLoaded', () => { function gameOver() { if(current.some(index => squares[currentPosition + index].classList.contains('taken'))) { scoreDisplay.innerHTML = 'end' - clearInterval(timerId) + clearInterval(timerId); + document.removeEventListener("keyup",control); //stops to click on any key } }