Ex. 6 Asking for feedback


#1


Hi,
I have no idea what's wrong with my code. Everything is fine until the last "else".


With the last "else" I have "SyntaxError: Unexpected token else".
I can't see mistake.
Maybe You can and will help me?


confirm("I'm ready");// Check if the user is ready to play!
var age = prompt("How old are you?");
if(age < 13)
{
    console.log("You can play, but it's your responsibility");
}
else
{
 console.log("Play!");
}
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.'");
}
var feedback = prompt("Rate the game, please. Use numbers from 1 to 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.");
}


#2

this line:

if(feedback > 8);

remove the semi-colon it prevents the if/else clause from working properly


#3

Thank you :slight_smile:
Fresh eye allways works.


#4

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