Code your own adventure 2! Halp :)


#1

I just don't know what my error is

var question = prompt("After you ate the pigs that army came back and saw you eat their pigs what do you do. RUN away, FIGHT them, or HIDE").toUpperCase();
switch (user) {
case 'HIDE':
var sneaky = prompt("Do you hide behind a suspicous thing (YES or NO)").toUpperCase();
var smartyPants = prompts("Are you smart ("
YES or NO ")").toUpperCase();
if (sneaky = 'YES' || smart === 'YES') {
var console = prompt("The army makes a lot of sound and wakes the suspicous thing and chases them");

} else {
var varyloud = prompt("The suspicous thing wakes up and eats you");
}
break;
case 'RUN':
var MACARONEY = prompt("you sprint and find a horse do you get on it("
YES or NO ")").toUpperCase();
if (MACARONEY = 'YES') {
var jeffijty = prompt("YOu find a magical horse and then fly away");
} else {
var badIdea = prompt("the horse is a trap and you are stuck there untili the army finds you");
break;
default:
console.log("Try Again")
}


#2

Here:

var smartyPants = prompts("Are you smart ("YES or NO ")").toUpperCase();

and here:

var MACARONEY = prompt("you sprint and find a horse do you get on it("YES or NO ")").toUpperCase();

In the first one you put 'prompts' while it should be 'prompt'

Since you used " to make the string for your prompt, you shouldn't use it for text inside the string, because now it reads it like this:
"Are you smart("
")"
And it returns an error because it doesn't know what to do with the YES or NO which isn't in a string.
You can avoid this by using ' to make the string, then using " inside your string, or using " to make the string, and ' inside. That way it won't be confused with what you're trying to do.

Oh, and also, make sure you put them on one line like I did.