Help please if/else syntax error


#1

I get a syntax error on else, but I don't see what's causing the error


confirm("I am ready to play!");// Check if the user is ready to play!
var age =prompt("What's your age");

if(age < 13);
{   
    console.log("Don't Play");
} 
else
{   
    console.log("Enjoy playing");
}


#2

You need to take the semicolon out after your if statement, so it looks like this.

var age =prompt("What's your age")

If that solved it please mark my reply as the solution.


#3

1) After var age = there should be a space before prompt.
2) After if(age < 13) there should not be a semicolon (;).
3) On CodeAcademy, you have to put the brackets on the same line as the text, as in:

if(age < 13) {
  ...
} else {
  ...
}

#4

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