diff --git a/_posts/2023-12-05-CSSE-oop-game-levels.md b/_posts/2023-12-05-CSSE-oop-game-levels.md index 07177e6..9d89994 100644 --- a/_posts/2023-12-05-CSSE-oop-game-levels.md +++ b/_posts/2023-12-05-CSSE-oop-game-levels.md @@ -281,6 +281,11 @@ document.getElementById('leaderboardButton').addEventListener('click', showLeade const playerScore = document.getElementById("timeScore").innerHTML; const playerName = prompt(`You scored ${playerScore}! What is your name?`); let temp = localStorage.getItem("playerScores"); + + if (!temp) { + temp = ""; + } + s temp += playerName + "," + playerScore.toString() + ";"; localStorage.setItem("playerScores", temp);