Created
June 11, 2020 12:42
-
-
Save Srushtika/03d39d726f7388753c9f93cfbf1488e9 to your computer and use it in GitHub Desktop.
Code snippet 35 - 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 + " is the first runner up"; | |
} | |
if (secondRunnerUp) { | |
document.getElementById("second-runnerup").innerHTML = | |
secondRunnerUp + " is the second runner up"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment