Problem with if/else statement not working?


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

confirm("Are you ready to play?");
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");

var userAnswer = prompt("Do you wanna 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.'")


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


okay thank you for the help:D


var age pertains to previous lesson not to the current lesson is what confusing... It must instruct the student clearly and completely instead of harrasing new comer giving in complete error messages over and over again... Hope Codecademy team will take a note to improve in this area... Warm regards... DasaAnudas.


Yes, but at the beginning of this mini project, its explicitly stated to not remove any code from your previous entries.

As you can see, this is the whole code the user provided - its missing everything from the previous lessons other than the game's confirmation No prompt for age, no if/else statement after submitting age, no prompt after submitting age...

This isn't a partial snippet, this is their whole code.


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