Old enough to play?


#1

Hi guys! I'm receiving this error:

There was a problem with your syntax.

Can someone help me pinpoint what I've missed in my code? Thank you!

confirm("I am ready to play!");

var age = prompt("What's your age);

if(age < 13)
{
    console.log("You're allowed to play, but we take no responsibility for nightmares.")};
    else 
{
    console.log("Play on, playa.");
}


#2

You forgot quotation marks after age.


#3

I'm still getting that same error. I must have other mistakes! (Thank you for noticing the other one though!) Can anyone see why I am still stuck?

// Check if the user is ready to play!

confirm("I am ready to play!");

var age = prompt("What's your age");

if(age < 13)
{
console.log("You're allowed to play, but we take no resposibility for nightmares.")};
else
{
console.log("Play on, playa.");
}


#4

You put the } in the wrong place. It shouldnt go after the console.log but at the very end of your code. Your else statement at the end of the code isnt closed. :slight_smile:

Remove the } after the "but we take no responsibility for nightmares" . Dont remove the } to close of the first part of the if statement. Your code has an unnecessary } right there. Then, put a new } at the end of your code.

confirm("I am ready to play!");

var age = prompt("What's your age");

if(age < 13)
{
console.log("You're allowed to play, but we take no resposibility for nightmares.");
}
else
{
console.log("Play on, playa.");
}
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");

var userAnswer = prompt("Do you want to race Bieber on stage?");

if (userAnswer) {
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
} else {
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}
var feedback = prompt("Rate the game on a scale of 1-10");
if (feedback >8) {
console.log("Thank you! We should race at the next concert!");
} else {
console.log("I'll keep practicing coding and racing.");
};` <--- THIS IS THE BRACKET YOU ARE MISSING


#5

Thank you so much!! That was exactly what was wrong as well. Guess I better start paying closer attention to my curly bracket placements :wink:


#6

And quotation marks aswell.