Old enough to play?


prompt("are you ready to play?");
confirm("I am ready to play!");
var age = prompt("what is your age");
if(age is less than 13);{
console.log("you are allowed to play but we take no responsibility");}
console.log("play on my bud");}

It says syntaxerror: expected ')'


if(age is less than 13);{
          ^            ^
          1            2

Two things wrong in this if statement.


(age < 13) // Not (age is less than 13)

2: The semi-colon " ; " , is an "End of Statement" expression. Meaning after you put it at the end of the if statement it will tell the code to skip over the expression within the opening and closing brackets " { ... } ". Just get rid of the semi-colon at the end of the line and you should be good to go :smiley:


thank you for your help


confirm("I am ready to play");
var age = prompt("What's your age");
if(age < 13)
console.log("You may play, but I take no responsibility);
{ // "otherwise"
console.log("Play on!");// do this code

Why do I keep getting a syntax error for this?


Hi Man,

I had the same problem and after many attempts solved it..
when you enter - var age = prompt('what's your age'); make sure that the 's in the word 'what's is Apostrophe.
I have entered it without any Apostrophe like ('Whats your age'); and it works perfectly
Try this and i wish it will work..
Good luck !!


Hi you also dont have a " on the end of your line console.log("You may play, but i take no responsibility");


Someone here help with this I tried to do what all of you said earlier in this chat-room but it still wont work plz help

confirm("I am ready to play!");
var age = prompt("Whats your age");
if(age is < 13)
console.log("Play ON")



Don't write "is" in your if statement test. Just write "if(age < 13)"


Ok I will try that :expressionless:


Your a legend!! Thanks :smiley: