[solved] Just need a fresh pair of eyes on the Code your own adventure, Justin Bieber concert exercise



I was wondering if somebody might be able to help me solve this problem I have been having with the Code your own adventure exercise.

I keep getting a "ReferenceError: yes is not defined" message but I am not sure why. As far as I can tell I have defined "yes" to be the go-ahead answer to race Justin Bieber onstage in the game, but no matter how many times I go over my code I cannot seem to find the mistake I am making. I am sure it is something silly that I have simply over-looked, and the fact that it is 3:35am right now probably isn't helping lol.

I will copy and paste the code I have so far in its entirety and if somebody could perhaps look it over and see what it is I am doing wrong that would be greatly appreciated.

Thanks in advance.

Please see the code I have so far written below:

confirm("Are you ready to play?");
var age = 13;
var age = prompt("How old are you?");
(age < 13) {
console.log("Sorry, you are too young.")

console.log("Ok, you may enter.")
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 = "yes";
var userAnswer = prompt("Do you want to race Bieber on stage?");
(userAnswer === yes) {
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!")
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")



Ah, scratch that. I have just figured out that I had simply forgotten to include quotation marks around one of my yes's.

Working fine now.

Thanks :smile:


You must realize that then you coding around the age=13 doesn't do much as then you're asking if the age you entered is less than age you entered just as well, wanker.