The story heats up! - Condition error


#1

confirm("I am ready to play!")

var age= prompt("What's your age");

if (age<13) {
console.log("You are allowed to play, but we take no responsability!");
}
else {
console.log("You are old enough to play this game! Go on!");
}

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"||userAnswer==="y") {
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
} else {
console.log("Oh no! Bieber is not racing!");
}

After I am typing "yes" or "no" it keeps telling me this message: Oops, try again. Did you remember to put in the 'no' answer option?

Need help, please. Thanks!


#2

@objectpro52472,
You have to use the EXACT text's

If userAnswer is "yes", print out:
"You and Bieber start racing. It's neck and neck! You win by a shoelace!"

Otherwise, print out:
"Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'"


#3

Thanks for your reply! It was helpful :wink:


#4

My problem is "SyntaxError: expected expression, got keyword 'if'"
and this is my code:
var age = prompt("What's your age?");
if (age < 13) {

console.log("WE TAKE NO RESPONSIBLIY ABOUT YOU PLAYING THIS GAME");

} else {

console.log("This is my first game, so enjoy");

}
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 Biber start racing. It's neck and neck! You win by a shoelance!")
} else {
console.log("Oh no! Bieber shakes his head and sins 'I set a pace, so I can race without pacing.'")
}


#5

Use the less-than < operator at the end of the userAnswer-prompt-code-line