What is the issue with my if/else statement


#1

I do not see what is wrong, can someone help me?

confirm(“i am ready to play!”);
prompt(“what’s your age”);
if (age >= 13);{
console.log(“you can play but i take no responsilibity”);
} else; {
console.log(“you can try again another time”);
}


#2

Start by considering what you mean by wrong, there’s got to be some reason why you think it’s wrong


#3

I’m not sure you’re about to respond to that, so I’ll go ahead and guess that you aren’t telling me that you’ve got a syntax error, but that you do, and that is what makes you think it’s wrong.

Syntax errors are generally trivial, basically you look up what something is supposed to look like, in this case it might be an if-statement? Your error message likely says where it is. So you might for example google “mdn if-statement” (mdn is a site with javascript documentation, very useful for looking up just about any language features), and then start comparing your if-statement to their examples. You might also try writing one small part of the code at a time and execute between each part to see if it’s still valid or not


#4

Go here to learn more about if-else of javascript


#5

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