Don't know what I'm doing wrong


#1

// Check if the user is ready to play!
confirm("Are you ready to play?");
var age = prompt("What is your age?");

if (age < 18) {
console.log("You play at your own risk.");
}
else (age > 18)
{
console.log("Have fun!");
}

Everything works until I get to the end, then I'm prompted with "Oops, try again. It looks like you didn't check for the user's age." What? Please help. Thanks.


#4

@onepunch_man love the name, just started watching that series :smiley: unfortunately I believe that you're on the wrong lesson, @paul_derengowskiyaho is on lesson two.

@paul_derengowskiyaho, I believe your problem consists of two parts.

1) the age is suppose to be less than 13, not 18.

2) Your "else" statement should not have any parameters! See below!

if (age < 13) { //Correct this line to say 13 like I have here!
 console.log("You play at your own risk.");
}
else {
  console.log("Have fun!");
}

#5

@lolman you're right !
Really ?! You're cool, we're going to be friends :stuck_out_tongue:


#6

Thanks lolman! It worked. I guess what confused me most was the earlier statement that told me to create my own scenario. Anyway, I'll try to stick more closely to the script next time. Again, thank you!