Stuck on this part >:(


#1



The story heats up!

SyntaxError: Unexpected token else

// Check if the user is ready to play!
console.log("are you ready to play ?")
confirm("I am ready to play!")
var age = 14
var age = prompt("what's your age");
if (age >16)
{
console.log("I don't take responsiblity but you're allowed to play")
}
else 
{
console.log("enjoy the game")
}
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

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

Should look like this:

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


#3

@lukemalik

Error says: Unexpected token else. Why is else unexpected? Maybe something extra is coming between it and the if statement:

if (userAnswer === "yes") <== see extra semicolon
} <== then closing brace with no opening brace partner
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
{
else  <== the "unexpected else"

Some recommended reading: When (not) to use semicolons

frisby :slight_smile: