Hello, I'm getting a error for my JavaScript text based game. Please fix.
var name = prompt("What is your name?");
var choice1 = prompt("Hello "+name+" you see two houses which one
do you enter? house 1 or house 2?");
confirm("you chose to open "+choice1);
if(choice1 === "house 1")
{
confirm("You entered house 1");
choice1 = prompt("You find a key on the porch want to pick it up?
yes or no");
if(choice1 === "yes"){
confirm("You picked up the key!");
confirm("You went inside !");
}
else if(choice1 === "no"){
confirm("You didnt pick up the key!");
confirm("You didn't enter house!");
}
}
else if (choice1 === "house 2")
{
confirm("You entered house 2");
choice1 = prompt("You find a sleeping sleeping lion? run or
walk");
if(choice1 === "run"){
confirm("You ran from the lion!");
confirm("The lion woke and got you!");
}
else if(choice1 === "walk"){
confirm("You walked slowly out the
house");
confirm("You didnt wake the lion!");
}
}
//note your input should be same as given in if condition... like house 1,house 2
<script>
var name = prompt("What is your name?");
var choice1 = prompt("Hello "+name+" you see two houses which one
do you enter? house 1 or house 2?");
confirm("you chose to open "+choice1);
if(choice1 === "house 1")
{
confirm("You entered house 1");
choice1 = prompt("You find a key on the porch want to pick it up? yes or no");
if(choice1 === "yes"){
confirm("You picked up the key!");
confirm("You went inside !");
}
else if(choice1 === "no"){
confirm("You didnt pick up the key!");
confirm("You didn't enter house!");
}
}
else if (choice1 === "house 2")
{
confirm("You entered house 2");
choice1 = prompt("You find a sleeping sleeping lion? run or walk");
if(choice1 === "run"){
confirm("You ran from the lion!");
confirm("The lion woke and got you!");
}
else if(choice1 === "walk"){
confirm("You walked slowly out the house");
confirm("You didnt wake the lion!");
}
}
</script>
Hello, I'm getting a error for my JavaScript text based game. Please fix. var name =...