5. The story heats up!


#1

So, I'm not sure what the issue with this code is. I run it and it works fine. I even continued to complete the other exercises in the section 2.

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?

// Check if the user is 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 Justin 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

Is it your full code? Did you check if the user is ready to play?


#3

var age = prompt("What's your age?");
if(age < 13)
{
console.log("Continue at your own risk...")
}
else
{
console.log("GO NUTS! and enjoy the game!")
}
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 Justin 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.'");
}

//This code worked, thanks to denys.matsevych for the prompt!


#4

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