It keeps on saying syntax error


#1

confirm("Are you ready to play?");
var age = (13);
var age = prompt("whats your age");
if(age < 13)
{
console.log("You may play the game but we are not held responsible")
}
else
{
console.log("Get ready to play")
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

You did not close your first else statement, oh no! :slight_smile:


#3

This is unneeded, as your prompt and comparison cover for it.

As kyleaw said, you didn't close the else statement.

While a semi-colon there isn't necessarily needed, it would do well to get in the practice of using them frequently for when Objects and Arrays come into play.

Hope I helped! :slight_smile:


#4

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