Syntax error, unexpected token else.. on Javascript lesson 6, (15%)


#1

// 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("Your allowed to play but I take no responsibility");
}
else
{
console.log("Go ahead and 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.");
}
var feedback = prompt("Rate my game out of 10");
if (feedback > 8);
{
console.log("Thank you! We should race at the nxet concert!");
}
else
{
console.log("I'll keep practicing coding and racing.");
}

This is my code but I can't find anything wrong with it. i keep getting the error in the title. Any help appreciated


#2

Note: It all works before lesson 6 so the problem must be in the code written in 6 as well.
var feedback = prompt("Rate my game out of 10");
if (feedback > 8);
{
console.log("Thank you! We should race at the nxet concert!");
}
else
{
console.log("I'll keep practicing coding and racing.");
}


#3

Can Someone please reply? If you cant find any problems then please suggest who i should contact


#4

Hi after all your if statement you should remove the ; after it.

if (userAnswer === "yes"); <==

#5

Wow, thanks you so much that worked! Not sure why i thought that there should be a semi colon after if in the first place, thanks again!


#6

Thank you! This helped immensely as I was stuck at the same point because of the extraneous ;


#7

thx so much this helped me too