5. Mine isn't working at all,


#1

Mine isn't working at all, I keep getting SyntaxError: Unexpected keyword 'else' ...?

Code:

// Check if the user is ready to play!// 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 ("Nah");
}
else
{ console.log ("You are ready to 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.'");
}

Heeeeellppppp :cry:


5.The Story Heats Up
#2

Also I've tried the code without the final else, and it mostly works, then stops and says "have you forgotten an 'else'?"...and then when it put it in it says SyntaxError: Unexpected keyword 'else'


#3

Try this confirm("Are you ready to play?");
var age = prompt("What's your age?");
if (age < 13)
{
console.log ("Nah")
}
else
{ console.log ("You are ready to 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.'")
}
//notice i took out the ;


#4

You have given semicolon in if condition
if(userAnswer === "yes");
remove the semicolon(:wink: and run the code..