I am having the wrong result for answering no for racing Bieber


#1



When I was testing this code, my result was wrong, instead, I have a respond that i raced him but I respond no. Here's my code for exercise 5-6.


// Check if the user is ready to play!
confirm("I am ready to play")
var age = prompt("What's your age?");
if(age > 13)
{
    console.log("You can play but you take no responsibility.");
}
else
{
    console.log("You are allow 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?'")
Prompt = userAnswer
prompt("Do you want to race Bieber on stage?")
if (userAnswer = prompt) 
{
    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.'")
}
var feedback = prompt("Did you enjoyed it, rate it out of ten.")
if (feedback > 8)
{ 
    console.log("Thank you! We should race at the next concert!")
}
else {
    console.log("I'll keep practicing coding and racing.")
}


#2

That's assignment. What do you mean for that to do?


#3

declare userAnswer as variable
var userAnswer = ("Do you want to race Beiber on stage?");
prompt(userAnswer);

or you can directly prompt the userAnswer
var userAnswer = prompt("Do you want to race Beiber on stage?");


#4

Here is all of my code. Hope it helps.


#5

var userAnswer= prompt("Do you want to race Bieber on stage?")

The problem was your spelling of "Bieber" as "Beiber". Correct that and you should be fine. Had a similar error simply because in my prompt; I used a capital letter to spell the 's' in "stage".