Javascript 5. The story heats up! does not have the correct instructions


The instructions for javascript "5. The story heats up" asks for an if /else: "Use an if / else statement to write out the last part of this game!"

However, if / else breaks. I have copy and pasted past working solutions and it fails. Only using two ifs works:

if(userAnswer ==="yes"){
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");

if(userAnswer ==="no"){
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");


@nyemichaelw instead of this:

you should just have:

       // code code

if you replace that your code should work


The same thing happened to me. Apparently the only way to get through this lesson is writing two different "if". Using "else" does not work at all.


You should already have your first if statement from when you asked the user for their age. If you've lost that part of your code then that causes a problem.


No,, you misunderstand: Your Reply to Bieber is a "Yes" or a "No", so they are correct:

The "Else" statement handles cases when the Answer does not match what the first check or if someone hits cancel or otherwise does not provide an answer that matches what the if() clause is checking.

To check for "No", you would need another If statement after checking for "Yes"

    Action A
    Action B
    Action C

Technically, as long as the answer isn't "Yes" you'd want the same "Else" output, but they're correct in that branching paths require more than just a simple If/Else statement


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