Can't find my mistake in this code, it keeps coming up as undefined


#1

// Check if the user is ready to play!
confirm ("Are you ready to play mate");
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 head and sings 'I set a pace, so I can race without pacing.'");

}

#2

where is your var age? you need to put that in. CodeAcademy is very picky so even if there is a spelling error it will reject your code. Use the link below to help you and the image below too.
Click here to help you


#3

@baljinderdhanda hope this helps

the code below is:

// Check if the user is ready to play!
confirm("Are you ready to play?")
var age = prompt("What's your age?")
if(age < 13) {
console.log("You are allowed to play but we hold no responsibility over you")
}
else
{
console.log("PLAY ON BUDDY!!!!")
}
{
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?'")
}
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 head and sings 'I set a pace, so I can race without pacing.'")
}


#4

thanks very much. this helps so much!!


#5

oh ...thanks !
everything is fine now~