SyntaxError: Unexpected token else


#1

i still get this error at the last step of the excercise: SyntaxError: Unexpected token else. i guess my code is correct....

// 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 can play without our responsability");
}
else{
console.log("let's 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 my game from 0 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

Hey @hack_solver_qdr1j,

I think you're wrong about "the right thing", I guess. :smiley:

:smile: :smile: :smile: :smile: :smile:

Sorry, I was joking. :smile:

You got a slight problem here, though. It actually seems slight, but is actually a MAJOR problem that's really hard to find.

It includes a semi colon.... a bracket... and a loop. Can you guess?

A semi colon in there is crucial and will make a huge problem in your code. This makes your if loop have no meaning, because what the semi colon does in there is disconnect the front bracket and the loop.

What does that mean? The '{' becomes useless, and the if loop would become a syntax error.

Comprende? :smiley: