It says I don't have an 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

Hi here

if (userAnswer = "yes")

Change = to ===


#3

For checking an equality, you have to use ===, and not =.
Also, you don't need a semi-colon after the second bracket of the else.


#4

that's not it. I still get the error message


#5

Try to refresh the page.


#6

this is true answer, you need add previous statement

var age = prompt("Whats your age?");

if (age < 13){
console.log("You are allowed to play BUT I dont take the responsibility");
}

else{
console.log("You can do it!");
}
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.'");
}