I'm having trouble in making the adventure game


#1


// Check if the user is ready to play!
confirm("I understand confirm!");
var age = prompt("What's your age");
if(age ==< 13); {
    console.log("Be careful, and play with a parent around at all times.");
}
else(age >== 14); {
    console.log("Play on, and have fun.");
}


#2

You can't have a semicolon after a if/else if/else conditional.


#3

Thanks :slight_smile:


#4

I just removed the semicolons, and it said there's a syntax error


#5

confirm("I understand confirm!");
var age = prompt("What's your age");
if (age < 13) {
console.log("Be careful, and play with a parent around at all times.")
}
else {
console.log("Play on, and have fun.");
}
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");
var userAnswer = prompt("Do you want to race Bieber on stage?");
if (userAnswer = Yes) {
console.log ("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}
else {
console.log("Oh no! Bieber shakes his had and sings 'I set a pace, so I can race without pacing.'");


#6

It keeps telling me there is a syntax error


#7

you have a problem here:

if (userAnswer = Yes)

in fact, you have two problems, because no quotation marks are used, Yes is a variable while it should be a string

a single equal signs means assign, you want to check if userAnswer equals "yes", which requires two equal signs


#8

Okay, I'll try that :relaxed:


#9

Thanks :grinning: :ok_hand:


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.