Unexpected error message: "Did you add an if statement to your code?"


#1




It works perfectly but an error message shows up saying "Oops, try again. Did you add an if statement to your code?", and it won't let me progress to the next lesson.


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

Refresh the page please


#3

Okay, I just did and nothing happened


#4

try another browser,

I don't know why you are getting an error your code looks fine.


#5

Okay, thanks for the help :slight_smile:
I think I'll be fine just skipping that one lesson, if I technically did it right.


#6

console.log('You are at a Justin Bieber concert, and you hear this lyric \'Lace my shoes off, start racing.\'');

Since your other strings use " instead of ' Your code should be:

console.log("You are at a Justin Bieber concert, and you hear this lyric \'Lace my shoes off, start racing.\'");

Another thing, is that you used two pairs of the same quotes, which obviously confused the computer.


#7

2 posts were split to a new topic: 5. error:Oops, try again


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.