mercredi 18 février 2015

The 'else' in my if/else statement never happens - can someone explain why? [duplicate]



This question already has an answer here:




Just doing the codecademy course, everything works when I run the code except for this if/else statement. When it gets to that, no matter what I input for the userAnswer prompt, I just get the 'if' output. Can someone explain why? Been reading this thing 100x and the answer isn't jumping out at me. Thanks a ton.



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

}




Aucun commentaire:

Enregistrer un commentaire