So I am trying to make a game where you choose your own adventure. But the loop I made with prompt does not work and makes the other code not work. I am new a java script so I am still trying to figure everything out. If anyone is able to help, I would appreciate it. The code I am using is
function myFunction() {
var option = prompt("Please enter Bat or Metal");
if (option == "bat" or "Bat" ) {
document.getElementById("path1c").innerHTML =
"Congrats! You killed the creature, but got bitten by the creature.";
else {
document.getElementById("path1c").innerHTML =
"Congrats! You killed the creature and were not harmed.";
}
}
Also I am using a button that calls myFunction on click, so that a prompt will show up.
Aucun commentaire:
Enregistrer un commentaire