Syntax error on 4


#1

Here's my code:

var userAnswer = prompt("Do you want to race Bieber on stage?");
if (userAnswer = yes) {
console.log("You say, 'I will!'");
}
else {
console.log("You say nothing. Many fangirls jump up and down saying, 'I do! I do!' They have a race and you feel jealous.");

I keep getting a syntax error, and I can't find it! Help!


#2

Inside your if condition, you have userAnswer = yes and it is wrong for 2 reasons. First, you are giving userAnswer value of yes, and second, that yes is nothing. What you should do is set condition like this userAnswer === "yes". It will check if userAnswer is string with a value of yes.


#3

This is what I have now:
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 say, 'I will!'");
}
else {
console.log("You say nothing. Many fangirls jump up and down saying, 'I do! I do!' They have a race and you feel jealous.");
}

But I still get syntax errors every time!


#4

it still will not work:cry: