Code Wont' Run Help 5. The story heats up


#1


For some reason my code won't work I don't know why.

  1. The story heats up is where I am.

    SyntaxError: Unexpected token {


// Check if the user is ready to play!
confirm("Are you ready to play?");
var age = prompt("What's your age? ");
if (age < 13) {
    console.log("You can play but don't blame me!");
} else {
    console.log("Play on!");
}
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 (userAnswer === "no") {
    console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}


#2

Get rid of all your { and } and that should fix your problem. They are all unnecessary.


#3

I have the same problem.


#4

else (userAnswer === "no") {
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}
You need to change this last line and also remove the (userAnswer === "no") leave the else alone.

replace your last line with : "Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'"


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.