Created
June 11, 2020 12:43
-
-
Save Srushtika/a7e7d71b345586d7b85de6435344654e to your computer and use it in GitHub Desktop.
Code snippet 36 - For multiplayer space invaders article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let winner = localStorage.getItem("winner"); | |
let firstRunnerUp = localStorage.getItem("firstRunnerUp"); | |
let secondRunnerUp = localStorage.getItem("secondRunnerUp"); | |
let totalPlayers = localStorage.getItem("totalPlayers"); | |
document.getElementById("winner-announcement").innerHTML = | |
winner + " won the game!"; | |
if (firstRunnerUp) { | |
document.getElementById("first-runnerup").innerHTML = | |
firstRunnerUp + " got the highest score"; | |
} | |
if (secondRunnerUp) { | |
document.getElementById("second-runnerup").innerHTML = | |
secondRunnerUp + " got the next highest score"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment