.5 The Story heats up


#1

I'm stuck on this lesson after banging my head in the desks for a little while and reading through other user posts. Can someone please help me spot what I'm overlooking? Thanks a ton.

// Check if the user is ready to play!
confirm("Are you ready to play?")
var age = prompt("How old are you?")
if(age < 13)
{
    console.log("You're not old enough but I don't really care.");
}
else(age > 12)

{
    console.log("That was the first test, you have passed");
}

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 === "yes"
{
    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.'");
}

#2

Can you post the error you are receiving?


#3

Oh yeah, sorry.

"SyntaxError: Unexpected identifier".


#4

I'm 90% sure that it's supposed to be

if (userAnswer === "yes")


#5

You're missing a few semicolons..


#6

Okay, I can see a couple of problems:

  • Your last var userAnswer line is missing a semicolon at the end

  • Your last if statement is missing parentheses around the condition userAnswer === "yes"


#7

//Check if the user is ready to play!
var age = prompt("whats your age");
if(10< 13) {
console.log("you can play")
}
else {
console.log("not a winner")
};
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 === "yes") {
console.log("you race")
}
else {
console.log("you don't race")
};


#8

you code should be like this

// 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 are allowed to play but i take no responsibility");
}
else{
console.log("You can do it!");
}
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==="yes"){
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.'");
}