Code your adventure help, this isnt working


#1

// Check if the user is ready to play!

console.log("Hello!");
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.'");
}

//Instructions //oops try again. did you add an if statement to your code?
Use an if / else statement to write out the last part of this game!

Make sure to check the console for error messages and suggestions for how to fix them.

?
Hint
Cut and paste the sentences that you have to print out to avoid typos. If you don't type things exactly right, things don't work!

Remember, if/else works like this:

if (condition) {
// Do something
} else { // Otherwise...
// Do something else!
}


#2

You should put this coder under your existing code.
So a least there must be two if/else statements.

If you copy the code from previous lesson and paste it here on the beginning it should work.


#3

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