5/7 Still can't find out what's wrong, please help


#1

I get the error: Oops, try again. Did you add an if statement to your code?
Thanks in advance for any help

// Check if the user is ready to play!
confirm("Are you 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.'");
}


#2

Your if statement isn't formatted correctly.
Your if statement looks like this:
if (condition) {
code code code
} else {
code code code
}

But, an if statement should look like this:
if (condition)
{
code code code
}
else
{
code code code
}

Just in case it may help you, I have added the correct formatting. (Feel free to copy and paste it into your code)

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.'");
}


#3

why didnt anyone comment on this being bad advice. Style preferences has nothing to do with "properly formatted code"