It says I have no if statement when I do


#1

5 The Story Heats Up

It says I don't have an if statement

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.'"); }

#2

In my browser, it works perfectly.... the sintax and estructure are right... try to refresh or re open your browser. Maybe check if you allowe to open the prompt window... without it, you don't have "yes" or "no" to let te code work...


#3

It is complaining because, by this point in the project, you should have 2 if statements. You are missing the one where you asked the player how old they were.


#4

var userAnswer=prompt("Do you want to race Bieber on stage");
if ( userAnswer === 'yes' || userAnswer === 'yeah' ) {
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.'");
}

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

please help me out


#5

Hi @digitalpro46364,

You also seem to be missing your other if statement, the one where you ask your player how old they are.