Syntax Error?


Every time I submit my code, I get a syntax error saying: Unexpected keyword 'else'. Here is my code:

// Check if the user is ready to play!
confirm ("I am ready to play")

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

if (age < 13);
console.log("You are allowed to play but I take no responsibility")

console.log("Keep playing on!)


no semicolon should be at the end


Syntax errors are one of the most common problems encountered, and one of the most overlooked as well. If you're having trouble with syntax errors, or unexpected identifiers, or are you unsure why you're not able to pass at all because codecademy isn't descriptive enough? Follow the link below to discover one of the most common issues encountered with not just javascript but many languages. This tool will greatly assist in your experience here at codecademy javascript courses.

Try their code here as well, there is more than simply semi colons in the wrong locations; there is an unclosed string, which is very easy to miss among the more apparent ones.


I totally missed that one


I used the jsHint tool and this is what came up:

I'm a beginner so I don't really know what these warnings mean. I fixed up the other errors. Can u tell me how to fix up the rest of the warnings?

I tried that code in the picture and it came up with another syntax error: Unexpected EOF



The code I used in the picture of the post was just an example, though I illustrated how you should find each line that the error code mentions and amend them one by one.

It says for your code, six warnings, and the first one is on line 32. Only focus on line 32 since it's reading your code in order, so make sure you amend that one first, because it may cause the following errors to be fixed as well.

Unclosed string is the error, that's pretty self explanatory isn't it? You have an unclosed string. . . you know that you need to enclose a string in quotation marks right? That's what makes a string. The other errors following it, such as unexpected ( is occuring because your string is open, and so those icons are not expected, this is why it's important to fix errors in order.


Sorry, I didn't look hard enough. I didn't notice the unclosed string before, so I was wondering why it was giving me a warning. It's easy to miss those and next time I need to look more carefully.

Thanks for helping! :smile:


What im just adding is for you to PLEASE Look at THIS Link. Thankyou!


Thank you for the heads up. I'll keep that in mind for my next post.