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.'");
}
If it’s “The story heats up!” exercise, there is nothing wrong with it. I wrote my code the same way, I got it right. I even went back, copy and pasted your code. I did not get any errors at all using your code.
Most likely the site just bugged out, giving you an error even tough the code is correct. If it still gives you an error message, close down codeacademy, open it up again. If it still persists try to log out then in again. If that doesn’t work, somebody else might have a solution for you. But the code seems to be correct since I didn’t get any errors using it.
// Check if the user is ready to play!
confirm(“I am ready to pay!”);
var age = prompt(“What’s your age”);
if(age<13)
{
console.log(“You’re allowed to play, but I take no responsibility”);
}
else
{
console.log(“Alright Mr. baggy pants, game on!”);
}
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(“Oh no! Bieber shakes his head and sings ‘I set a pace, so I can race without pacing.’”);
}
else
{
console.log(“Oh no! Bieber shakes his head and sings ‘I set a pace, so I can race without pacing.’”);
}
Oops, try again. Did you remember to put in the ‘yes’ answer option? is the error I get.
I’ve tried removing the “yes” from the prompt userAnswer. Then I get an error that the yes var is not defined.
Oh and the only error, if you look, I had noticed that both the else AND the if statement consoles returned the same thing, I had copy and pasted the same sentence in the quotes.
For some reason, the error checker gave me an error based on the yes part of the code and not the sentence errors which technically are still correct, just not the way the assignment was set. It should have given another type of error. It almost was distracting from the real problem.