Confirm age


#1

confirm(" I AM READY TO PLAY!");
var age = prompt("what is your age");
confirm("This is my age");
if(age < 18)
{
console.log("Play at your own risk");
}
else
{
console.log("Have fun gaming");
}

this is my code. all the prompts come up including the one asking your age, but it says an error that i didnt check the users age. pls help


#2

You did it incorrectly, but just with this:

Instead of 18, try replacing it with 13, as said in the directions. If it still doesn't work, refresh.


#3

Also make sure your strings are displaying what's supposed to be displayed exactly, if they are telling you specifically what to say.


#4

REAL CODE

confirm (" Are you ready to play ? ");
var age = prompt("What is your age?");
if (age < 13)
{
console.log("You can play this game but we are not responsible");
}
else
{
console.log("We encourage you to play this game");
}


#5

My code was correct, but IE did not like it.
My fault for using IE.
I tried it in Chrome, and it worked straight away


#6

confirm("Let's Go!");
var age=prompt("How old are you?");
if (age under 13);
{
console.log("You can play, but we take no responsibility");
}
else
{
console.log("Great, play on!");

I keep getting SyntaxError: missing ) after condition, but there is a ) after the condition. I don't understand!


#7

How can you express this condition using a comparison operator?


#8

It doesn't ask for one, and that's not what it says the problem is.


#9

If you look up what a comparison operator is and does in javascript, it would help you understand what you're having difficulty with.


#10

Wat dit I wrong in this code can some wan tell me ?
var age = propmt;
if(age < 13)
{
console.log("you are allowed to play but you take no responsib");
}
else
{
console.log("you are ready to enter the game !");
}


#11

Thanks guys, this helped :smile: I think most people just choose the wrong age. It has to be 13.


#12