Expected an identifier and instead saw 'else' missing ";" before statement


#1

I am getting an error message

Expected an identifier and instead saw 'else' missing ";" before statement

I am early into the lesson and already stuck

confirm("I am ready to play");
var age=prompt("What's your age?");
if (age>=13);
{
console.log("Welcome");
}
else
{
console.log("Welcome, play at own risk");
}


#2

Hi @mgarrett12,

Simply take away the semi-colon it is unnecessary and messing up the code.

Also the question is asking you to console.log Welcome, play at own risk if the user is under 13 you need to switch your point bracket this way > to this way <.

Let me know if that worked :slight_smile:


#3

Thank you, that worked.


#4

Most welcome, glad to help.


#5

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