Part 5 (Code your own adventure – the story heats up!) error


#1

Help please...

https://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/5?curriculum_id=506324b3a7dffd00020bf661#

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


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 { // Otherwise...
    console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}


#2

i think when you have the ===, you forgot the space at the front and back. so it shold look like this:

if(userAnswer === "yes"); {

if this is any help, please know who to thank! :wink:


#3

yes! just copy what I wrote and you will get it correct. trust me, I finished the game!


#4

@wnemitz, although usually you would be correct, codecademy insists that there be spaces in between if and (...). There should also be no semicolon, in between if (...) and {.
@megapro88796, I cannot see anything wrong with your code. The only thing I can suggest is to leave a space in between the variable being checked and the === and then again between them and the answer, so if (userAnswer === "yes") {...}.


#5

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