The story heats up![SOLVED]

Please, what’s wrong with that code below?

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

What error are you getting?


“Oops, try again.Did you add an if statement to your code?”.


i don’ know i meet the program

Can you post a link to the exercise please?

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.

Thanks! I suspect that is a bug indeed.

HI it’s because you remove the if statement that check for the age

Ok, it’s solved. Thanks.

how to solve?? I can’t see the age code now!
there is no if else code!

// Check if the user is ready to play!
confirm(“I am ready to pay!”);
var age = prompt(“What’s your age”);
console.log(“You’re allowed to play, but I take no responsibility”);
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.’”);
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.

HI you should type


in the console because in the if statement

if (userAnswer === "Yes")

you wrote "Yes"

I’m not following.
I tried it with and without the quotes in the
if (userAnswer === Yes);
as well as:
if (userAnswer === “Yes”);

I also tried it with all lower case just for troubleshooting.

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.

SOrry I said type in the console so after you click on Save & Submit Code you should type Yes

#Or you could it simple

just change the “Yes” here

if (userAnswer === "Yes")


if (userAnswer === "yes")

then in the console after you click on Save & Submit Code just type yes

Also, it is smart to remember that the character can work as a "

it is showing syntax error \

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