I need help on code your adventure lesson 2


Why does it says "syntax error:unexpected identifier"?

here is the code i wrote

// Check if the user is ready to play!
confirm('Are you ready to play');
var age = prompt("What's your age");
if(age is less than 13);
    console.log("You are allowed to play but I dont take full responsibility");
    console.log("Get ready to play your best game");
Under the existing code, declare a variable age.
Make age equal to prompt("What's your age");. See the example above.
Then write an if/else statement. If age is less than 13, use console.log to tell the user that they're allowed to play but you take no responsibility.
Else, use console.log and give them an encouraging message to play on!


less than operator <
so here
if(age< 13); //

and remove ; after if condition.

check Comparison operators


i am getting the same thing, here is what i got:
// Check if the user is ready to play!
confirm("Are you ready?")
var age = prompt("What's your age");
if(age is < 13)
console.log("you may play but i take no responsibility")
console.log("we will get there")


Why using "is"? You should only use operators.


my reading is not that great, i am learning new skills after a long recovery from serious head injuries.


Oh! You will be better soon. :slight_smile:

We learn from mistakes and that's not bad. Keep it up and keep trying. You will be an expert one day.

We are here to learn and help. :slight_smile:


thank you guys ■■■■ i just follow the writing on the instruction , i forgot the basics
much love!


What is wrong in my code ? please help me ...


what the error massaage you are getting?
missing ) after argument list
so you should think about that

in your code
else statement
console.log("hurry ! go ahead"!);

! shouldn't be inside of " " ?


I tried as you said even then it is shown the error message
"SyntaxError: missing ) after argument list"


Finished this exercise and this is the code ...
var age = 12;
var age = prompt("what's your age");
if(age < 13){
console.log( "you're allowed at your own risk!");
console.log( "hurray go ahead!");


remove this line

var age = 12;

its like you have extra code.because in seocnd line you are asking user what's your age
the value will be set to the variable age.
for example:
if user input 15 then it'll be like

var age = 12;
var age = 15;

First one is not valid now.


A post was split to a new topic: I get: ReferenceError: promt is not defined


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.