It says that else has a syntax error. I need help!


#1

confirm("I am ready to play");
var age = prompt("What is your age?");
if(age < 13);{
console.log("Your allowed to play with adult super vision");
}

//Right here is here it shows the x// else

{
console.log("You will really enjoy this game!");
}


#2

The general if/else syntax is this...

if(condition){
    //yourcode
}
else{
    //yourcode
}

Now match this syntax with your if/else...

Point1.
if(age < 13); <-- Remove this semi colon

Point 2.
You have to put this code in else clause.

console.log("You will really enjoy this game!");

You mistakenly commented out else... //Right here is here it shows the x// else


#3

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