diff --git a/snake.html b/snake.html index d2b7b42..a11d053 100644 --- a/snake.html +++ b/snake.html @@ -68,7 +68,7 @@ let snake, dir, nextDir, food, score, highscore, running, paused, animId; - highscore = parseInt(localStorage.getItem('snake_hs') || '0'); + highscore = getHighscore('snake'); highscoreEl.textContent = highscore; function init() { @@ -109,7 +109,6 @@ if (score > highscore) { highscore = score; highscoreEl.textContent = highscore; - localStorage.setItem('snake_hs', highscore); } spawnFood(); } else {