diff --git a/frontend/public/games/jump-counter/script.js b/frontend/public/games/jump-counter/script.js index 2e8c225b..69c0662d 100644 --- a/frontend/public/games/jump-counter/script.js +++ b/frontend/public/games/jump-counter/script.js @@ -90,7 +90,7 @@ function createObstacle() { const moveObstacle = setInterval(() => { if (gamePaused) return; - let obstacleLeft = parseInt(obstacle.style.left); + let obstacleLeft = parseInt(obstacle.style.left, 10); if (obstacleLeft <= -40) { obstacle.remove(); obstacles.shift(); diff --git a/frontend/public/scripts/2048.js b/frontend/public/scripts/2048.js index dbefd0f5..7995b001 100644 --- a/frontend/public/scripts/2048.js +++ b/frontend/public/scripts/2048.js @@ -5,7 +5,7 @@ class Game2048 { this.previousScore = 0; this.score = 0; this.moves = 0; - this.bestScore = parseInt(localStorage.getItem('2048-best-score')) || 0; + this.bestScore = parseInt(localStorage.getItem('2048-best-score', 10)) || 0; this.gameWon = false; this.gameOver = false; this.canUndo = false; diff --git a/frontend/public/scripts/simon.js b/frontend/public/scripts/simon.js index 7afed7fc..85df0fe7 100644 --- a/frontend/public/scripts/simon.js +++ b/frontend/public/scripts/simon.js @@ -2,7 +2,7 @@ let sequence = []; let playerSequence = []; let level = 1; -let highScore = parseInt(localStorage.getItem('simonHighScore')) || 0; +let highScore = parseInt(localStorage.getItem('simonHighScore', 10)) || 0; let gameActive = false; let showingSequence = false; let inputLocked = false; 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 = [