5. The Story Heats Up! Help! Syntax Error


#1

This is what i wrote. I believe it's right, but it keeps saying syntax error. What's wrong?

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

Remove the semicolon


#3

I removed it but still the same error. This is what it looks like now. Any help?

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


#4

confirm ("I am ready to play!")
var age = prompt("what's your age?");
if (age < 13)
{
console.log ("You're allowed to play but I take no responsibility")
}
else
{
console.log ("Welcome to happyland")
}
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.'");
}

This is what I ended up with when I finished this segment. Did you keep all the code from the previous segments?


#5

yeah, this is it:

confirm("Let's get to it!");
var age = prompt("How old are you?");
if (age < 13)
{
console.log("Go ahead, but WARNING: We take no responsibility");
}
else
{
console.log("Great! You're just right! Move ahead!");
}
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.'");
}


#6

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

and....

if (userAnswer = "yes")
^ change to ===


#7

You forgot a semi-colon on the first "console.log"


#8

I got it now. Thanks guys