2. Code Your Own Adventure


confirm("I am ready to play!");

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

if(age < 13); {
console.log("You are allowed to play but we do not take any responsibility.");
} else {
console.log("Let's play!");

I put this code and it says I have a syntax error.

if(age<13); {}

There should be no semi-colon on a line that ends with an open curly bracket.


there shouldn't be anything between your your if (test condition) { block of code } else { block of code } statements


There is nothing between his if and else statements


Thanks guys it worked


the semicolon is between his statements, as you stated
i was showing how the if statement should be formatted. a template
if (test condition) { block of code } else { block of code }


But it could be confusing saying there shouldn't be anything between if and else statements. That makes it sound like he put something like if (test condition) { block of code } (some random code) else { block of code }


you must be misunderstanding what i said... i didn't say "there should be something between"
besides he got the problem now. and i honestly dont know how you could understand it
as to insert a random code in between the if and else when i give the template and say there shouldn't be. :confused:


note that

if(age < 13); {

remove this ; and try again


I have the same problem but I did not put ;. I am stuck. I do not know where I messed up