SyntaxError: Unexpected token else


#1

I have this issue with else if statements. Every time i get " SyntaxError: Unexpected token else". Can someone please explain why this is? thank you in advance.

var userAnswer=prompt("Do you want to race on stage?");
if(userAnswer==="yes");
{
console.log("You win!");
}
else
{
console.log("Oh no! You lose");
}


#2

Hi you should remove the ; after the if condition

if(userAnswer==="yes"); <== this one

For more information you could read this


#3

Thanks it help :smile: