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/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/sudoku.js b/frontend/public/scripts/sudoku.js index 72c98737..815de8fd 100644 --- a/frontend/public/scripts/sudoku.js +++ b/frontend/public/scripts/sudoku.js @@ -104,7 +104,7 @@ function handleKeyPress(e) { const key = e.key; if (key >= '1' && key <= '9') { - inputNumber(parseInt(key)); + inputNumber(parseInt(key, 10)); } else if (key === 'Delete' || key === 'Backspace') { clearCell(); } 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 = [