# Help with Logical Operations

#1

Hi Guys I needed help with this program I don’t know what I did wrong in the Logical Operations in Code Your Adventure 2

``````

var user = prompt("You are a knight during the medieval times and you come across a dragon. What would you do? RUN, FIGHT or PAY").toUpperCase();
switch(user) {
case 'RUN':
var brave = prompt("You are a scaredycat ! To run away you have to run underneath the dragon. Are you brave enough to do it? (YES or NO)").toUpperCase();
var scared = prompt("Are you scared to do it? (YES or NO)").toUpperCase();
if(brave === 'YES' && scared === 'NO'){
console.log("You have survived running under a dragon");
}else{
console.log("You have been scathed and eaten up ;(");
}
break;
case 'FIGHT':
var weapon = prompt("You have two weapons a sword and a axe. Would you fight with a sword? (YES or NO)").toUpperCase();
var how = prompt("Would you use the sword to stab the dragon in the throat or just wound it a lot so it bleeds to death? (YES for stab to throat or NO for wounding a lot)").toUpperCase();
if(weapon === 'YES' && how ===  'YES'){
console.log("Nice choice you have gotten a dragon head for a trophy and you win !");
}else{
console.log("The dragon slashed you with it's claws and you died ;(");
};
break;
case 'PAY':
var money = prompt("Do you have money? (YES or NO)").toUpperCase();
var dragon money = prompt("Do you have dragon money? (YES or NO").toUpperCase();
if(money === 'YES' || dragon money === 'YES'){
console.log("Great the dragon is okay with it");
}else{
console.log("The dragon is okay with any type of money");
};
break;
default:
};

``````

#2

Hi this part

`````` var dragon money = prompt("Do you have dragon money? (YES or NO").toUpperCase();
if(money === 'YES' || dragon money === 'YES'){
console.log("Great the dragon is okay with it");
}
``````

you should remove the space between dragon and money with a _

#3

It didn’t work the error message I got was Oops, try again. There was a problem with your syntax. and SyntaxError: Unexpected identifier

#4

can you post your new code?

#5

I only changed the part you told :
var user = prompt(“You are a knight during the medieval times and you come across a dragon. What would you do? RUN, FIGHT or PAY”).toUpperCase();
switch(user) {
case ‘RUN’:
var brave = prompt(“You are a scaredycat ! To run away you have to run underneath the dragon. Are you brave enough to do it? (YES or NO)”).toUpperCase();
var scared = prompt(“Are you scared to do it? (YES or NO)”).toUpperCase();
if(brave === ‘YES’ && scared === ‘NO’){
console.log(“You have survived running under a dragon”);
}else{
console.log(“You have been scathed and eaten up ;(”);
}
break;
case ‘FIGHT’:
var weapon = prompt(“You have two weapons a sword and a axe. Would you fight with a sword? (YES or NO)”).toUpperCase();
var how = prompt(“Would you use the sword to stab the dragon in the throat or just wound it a lot so it bleeds to death? (YES for stab to throat or NO for wounding a lot)”).toUpperCase();
if(weapon === ‘YES’ && how === ‘YES’){
console.log(“Nice choice you have gotten a dragon head for a trophy and you win !”);
}else{
console.log(“The dragon slashed you with it’s claws and you died ;(”);
};
break;
case ‘PAY’:
var money = prompt(“Do you have money? (YES or NO)”).toUpperCase();
var dragon_money = prompt(“Do you have dragon_money? (YES or NO”).toUpperCase();
if(money === ‘YES’ || dragon money === ‘YES’){
console.log(“Great the dragon is okay with it”);
}else{
console.log(“The dragon is okay with any type of money”);
};
break;
default:
``````if(money === 'YES' || dragon money === 'YES')