JS Old enough to play?


#1

// Check if the user is ready to play!
confirm("I understand confirm!");
confirm("I am ready to play!");
var age = prompt("What's your age?");
if(age < 13)
{
console.log("You can play,but I take no responsibility!");
}
else {
console.log("Go ahead! You'll play very good!");
}


#2

Hi Julia,

the "if: part should look something like this:

if(13>(age))

i guess one of the rules is that in writing conditional statements, put the number or the script before the variable


#3

Hey @julia_programmer! Your actually right i will provide a screenshot below showing that. And @megaplayer05756 that is not the problem just because you put a parantheses in a variable getting in a conditon dosent affect a problem most of the time..

So the screen shot(i dont understand your problem is it not working for you?):


#4

I'm glad that it worked for you instantly, but I had the same problem as hers, and what I pasted above worked for me.

I'm not saying that your solution is wrong, because it's not, but the site can act faulty depending on your browser.

but hey @amanuel2, you learn something new every day right?


#5

I am getting this message "oops, try again. It looks like you didn't check for the user's age" when think I did check for age... what am I missing? going nuts

confirm("Are you ready to play?");
var age = prompt("What's your age");

if (age<= 18)
{
console.log("I am not old enough to play");
}else{
console.log("You can play all day");

}

(and if I am posting incorrectly, please let me know.. I am totally new to this)


#6

Yeah, what browser do you use. And can you printscreen in here.


#7

Hey @iriekat! Two things, first when you paste your code, it is going to be formatted when you select over your code and hit CTRL + K. Secondly your problem is that you just need another confirm like for example saying:I understand confirm! So put this in the top of your code and it should work!!

confirm("I understand confirm!");

#8

thanks for the quick response @amanuel2

-Google Chrome as Browser

... hmmm.. you mean like this


#9

I still get the error message saying I did not check for users age


#10

oops - this is the correct print screen


#11

This is a major bug, i better make an announcment


#12

Did you try if(age<13)? Sometimes the exercises ask specific things and we must do as asked :smile:


#13

Please don't encourage the use of images over code, it's annoying when you can't copy and paste the code in to check it, but instead have to type the whole thing..

-It's also against community guidelines.


#15

@jibblyj thank you for the correction. Noted for the future. I'm really really new to all of this.


#16

guwo.. DUH.. you are the man/woman!?
it worked with 13.. ughhhhhh thank you ...
:joy:


#17

Im just trying to see if it is actually legit. And how is it against the community guildlines.


#18

You're supposed to try and help debug other people's code instead of just giving them your code.


#19

inferior beings accept defeat


#20

What's that supposed to mean, exactly?


#21

this is my code and it works very well
// Check if the user is ready to play!

confirm ("are you 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");
}
else {
console.log ("Have fun playing! good luck bro!");
}