diff --git a/frontend/public/games/flappyBird/flappy.js b/frontend/public/games/flappyBird/flappy.js index e6dbae00..689b263f 100644 --- a/frontend/public/games/flappyBird/flappy.js +++ b/frontend/public/games/flappyBird/flappy.js @@ -52,7 +52,7 @@ bottomPipeImg= new Image(); bottomPipeImg.src="bottompipe.png"; requestAnimationFrame(update); -setInterval(placePipes, 1500); //1.5 sec +clearInterval(window.__interval); window.__interval = setInterval(placePipes, 1500); //1.5 sec document.addEventListener("keydown",moveBird); }; context.drawImage(birdImg, bird.x, bird.y, bird.width, bird.height); diff --git a/frontend/public/games/jump-tag/script.js b/frontend/public/games/jump-tag/script.js index c2d520ba..91d8e99f 100644 --- a/frontend/public/games/jump-tag/script.js +++ b/frontend/public/games/jump-tag/script.js @@ -106,7 +106,7 @@ if (player.onGround && player.state === 'alive') { player.vy = -720; player.onGround = false; - if (!muted) audioJump.currentTime = 0, audioJump.play().catch(()=>{}); + if (!muted) audioJump.currentTime = 0, audioJump.play().catch( => console.error()); } } diff --git a/frontend/public/scripts/tic-tac-toe.js b/frontend/public/scripts/tic-tac-toe.js index be2c8d51..c17e0570 100644 --- a/frontend/public/scripts/tic-tac-toe.js +++ b/frontend/public/scripts/tic-tac-toe.js @@ -17,7 +17,7 @@ function saveScore(score) { let board = ['', '', '', '', '', '', '', '', '']; let currentPlayer = 'X'; let gameActive = true; -let scores = JSON.parse(localStorage.getItem('ticTacToeScores')) || { x: 0, o: 0, draws: 0 }; +let scores = (JSON.parse(localStorage.getItem('ticTacToeScores') ?? "null") ?? null) || { x: 0, o: 0, draws: 0 }; // Winning combinations const winningConditions = [ diff --git a/frontend/public/scripts/whack-a-mole.js b/frontend/public/scripts/whack-a-mole.js index e897de2c..386a81de 100644 --- a/frontend/public/scripts/whack-a-mole.js +++ b/frontend/public/scripts/whack-a-mole.js @@ -47,7 +47,7 @@ function trackVisit() { }, credentials: "include", body: JSON.stringify({ game: "whack-a-mole" }) - }).catch(() => { }); + }).catch( => console.error()); } function trackPlay() {