Javascript help. Cant figure out what is wrong with this line of coding


#1

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

Hey @adrielgolabek,

I want to tell you that when you are posting, you should show something more specific. But I'll help you :wink:

Strangely, all the problems are located here. Yup, right here.

Problem:

  • You set useranswer to "yes", not equal to. Use === instead of =.

  • The variable is userAnswer not useranswer


#3

hahah thx. just went through recent posts and got help.


#4

3 posts were split to a new topic: Whats wrong with this code?


#5