Help on Justin Bieber game! Please!


#1

Hi I am new here. My code for the JS game keeps on saying syntax error whenever I try to save and submit it! Ill provide the code and can someone tell me what I did wrong?
// Check if the user is ready to play!
confirm("You ready to play?");
var age = prompt("How are old are you?");
if(age is less than 13);
{
console.log("Play at your own risk.");
}
else
{
console.log("Game on!")
}


#2

Hey Aidan, Welcome to CodeCademy!

The problem with your code is that you used if(age is less than 13); to check if the age is lower then 13 but Javascript does not know is less than. The let your code work you should replace is less than with <. We use that symbol to check if something is less then something else.

The second problem with your code is that you close your if statement by using a ; at the end of line 4

The working code should look something like this:

// Check if the user is ready to play!
confirm("You ready to play?");
var age = prompt("How are old are you?");
if(age < 13)
{
console.log("Play at your own risk.");
}
else
{
console.log("Game on!");
}

#3

Hi amandovledder! Thanks so much for helping me! And for future reference my name is spelled Aidan not Aiden. People make that mistake a lot :stuck_out_tongue: .