Code your own adventure, Help?


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")
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.'") }


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 " "


Thanks that helped me allot! have a nice day!


What is wrong with the feedback part of the code? (]


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


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)


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