I need Help!


#1

What seems to be the problem with the following code?

confirm("I am ready to play");
var Age = prompt("What is your age")
if ( Age < 13 )
{
console.log("You can still play!");
}
else
{
console.log("Great you are in");
}
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 Beiber on stage?")
if (userAnswer = "yes")
{ console.log("You and Bieber start racing. It's neck and neck! You wun 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

@t-diddy12
Well, first check your semicolon each time your declaring a variable or log a string in your console. You should make sure to put semicolon at the end of each instructions so JavaScript understand you're starting another instruction. Look also after your else statement, you forgot to put a curly bracket to end the statement.
Your code should look like this;

confirm("I am ready to play");
var Age = prompt("What is your age");
if ( Age < 13 )
{
console.log("You can still play!");
}
else
{
console.log("Great you are in");
}
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 Beiber on stage?");
if (userAnswer = "yes")
{ console.log("You and Bieber start racing. It's neck and neck! You wun by a shoelace!");
}
else
{
console.log("Oh no! Bieber shakes his head and sings 'I set a pace so I can race without pacing.'");
}