5/7 Glitch, Maybe? Can't Find the Problem


var age = prompt("What's your age")
if(age < 13){
console.log("You will be allowed to play, but I as the creator take no responsibility.")
} else {
console.log("Start playing; a great adventure (sort of) awaits you.")
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.'")

more help, plz, thx


if(userAnswer =   yes){

You're saying userAnswer is equal to yes instead of "yes". It's comparing a string, but the word yes alone makes the computer think it's a variable.

Secondly, this is a comparitive expression, so you should not be assigning any value to "userAnswer" instead you should add another equals sign " = " to make the expression a comparison instead of an assignment.


if(userAnswer === "yes"){

instead of:

if(userAnswer =   yes){