Possible problem in syntax I think, please help


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-x9DnD/0/5?curriculum_id=506324b3a7dffd00020bf661

So for the code below, everything works great except for the last bit starting from var userAnswer. The prompt works too, but if I say no, then it still prints out the if statement that you start racing and win.

What is the issue? I have tried changing "yes" to just yes, and then typed no in the prompt box and then I got an error message saying yes is not defined

confirm("I am ready to play");
var age=prompt("What's your age?");
if (age<13){
    console.log("User is allowed to play, but I take no responsibility");
}
else{
        console.log("user is allowed to play");
}
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 this part you should use === instead of =


#3

@faar23

Don't use = sign this is for assigning value. Use === sign for compairing value


#4

Thanks, now it works.