Code your own adventure, Help?


#1

I keep getting a syntax error for this program?
what am I doing wrong?

// Check if the user is ready to play!
confirm("Are you ready to play?");
var age = prompt("Whats your age?");
if (age < 13)
{
console.log("You are allowed to play but we take no responsibility")
}
else
{
console.log("Keep playing!")
}
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 (userAnswer === no) {
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'") }


#2

else (userAnswer === no)

else doesn't allow to have a condition.if you've more than one condition than you can use else if.

Also yes and no both are string so both should be inside " "


#3

Thanks that helped me allot! have a nice day!


#4

What is wrong with the feedback part of the code? (https://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/6?curriculum_id=506324b3a7dffd00020bf661#]


#5

Do I need an if? I created one but it didn't work. Help please.:kissing:


#6

Never mind. I left out this game in the part where you ask for feedback:
var feedback = prompt("How would you rate this game out of 10?");

Forgive me if you were already going to help me. (This is the second time today)


#7

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