2. Old Enough to Play


#1

var age = prompt("What's your age");
if (var age < 13) {
console.log("You are allowed to play but we take no responsibility!");
}
else {
console.log("Play on and win! You can do it!");
}
Says for the error SyntaxError: Syntax error


#2

@rayjulian,

You will have to change your

if (var age < 13) {

into

if (age < 13) {

#3

Thanks! That fixed it. Never even noticed it


#4

4 posts were split to a new topic: It says syntax error


#8

// Check if the user is ready to play!
confirm("ready to have fun? [NOTE: clicking 'OK' says you have required I.Q. to play]");
var age = prompt("What is your name, Esquire?");
if(age <= 23)
{
console.log("Leaving Game");
}
else
{
console.log("This 'Game' will decrease your I.Q.")
}
says i didn't check the age


#9

Can not figure out why this will not be accepted...

confirm ("I am ready to code!")
var age=prompt("What's your age");
If ( age < 13) {
console.log("You're allowed to play but we take no responsibility");
}
else {
console.log("let's go!");
}


#10

before all of that did you do
var age = 16
you have to put a age if that dosent work sorry:grinning:


#11

@tagsolver57652 try adding a semicolon after the

confirm("I am ready to code!")


#12

thanks for the hints but it still won't take it!!!


#13

@tagsolver57652,
What kind of "Oops..."- or Error- message are you receiving....