[solved]5. the story heats up my code works but i noticed a strange problem


#1


confirm("Do you want to play a game?");
var age = prompt("What is your age?")
if(age < 13)
{
console.log("You must be 13 or older to play, but we take no responsibility.")
}
else
{
console.log("Enjoy!")
}
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(userAnswer === "no")
{
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")
}

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

Enjoy!

You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'
Suddenly, Bieber stops and says, 'Who wants to race me?'
You and Bieber start racing. It's neck and neck! You win by a shoelace!
Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'

Why does my code as if i say yes and no?

this code still lets me past the lesson


Replace this line with your code.


#2

figured it out. nvm
i missed a ==


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.