Please Help: Syntax Error Unexpected token else


#1


Here is the link to the exercise iam stuck at:
https://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/2?curriculum_id=506324b3a7dffd00020bf661#

I am getting a message "Syntax erroe unexpected token else.I don't know what Iam doing wrong.


Here is my code:// Check if the user is ready to play!
confirm("I am ready to play");
var age = prompt("What's your age");
if(age<13);
{
 console.log("You are allowed to play but, I take no responsibility");
 }
else 
{
 console.log("Please play on,enjoy");
}


#2

this line:

if(age<13);

that is one very dangerous semi-colon, preventing your if statement from running properly. Remove the semi-colon


#3

Thanks you so much Stetim94.I removed the semi-colon and my code ran perfectly.Just to be clear,i don't need to put a semi-colon in my if statement,i.e the condition?


#4

Absolutely not, as you just discovered the program doesn't run properly when putting a semi-colon on your if condition, you must not put semi-colons at your if condition (very important)


#5

Thanks very much.I have learnt a valuable lesson.I will never forget that.