It keeps picking the wrong option! Help please


#1

It says I was successful but after the first one which is successful in providing a response to if your 13 or not; the next two or three questions keep picking the same option even when the answers different?
what am I doing wrong?
// Check if the user is ready to play!
confirm ("the game is afoot");
var age=prompt("You need to be over 13 to play, are you over the age of 13?");
if(age <13)
{
console.log("Continue at your own risk");
}
else
{
console.log("Keep playing");
}
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 ("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.'");
}
var feedback=prompt("Rate the game 1-10");
if (feedback<8)
{
console.log ("Thank you! We should race at the next concert!");
}
else
{
console.log ("I'll keep practicing coding and racing.");
}

For instance in the who wants to race me question it just responds "you and Bieber start racing..." no matter what the answer is and its the same for the following question.


#2

@betapro09997 take a look at this comments I have made in your code and I want you to pay close attention to the second if statement.

// Check if the user is ready to play!
confirm ("the game is afoot");
var age=prompt("You need to be over 13 to play, are you over the age of 13?");
if(age <13){ //You check for age great
    console.log("Continue at your own risk");
}
else{
    console.log("Keep playing");
}
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 ("Yes"){ //****but here if what is -> "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.'");
}
var feedback=prompt("Rate the game 1-10");

if (feedback<8){// you checked for feedback
    console.log ("Thank you! We should race at the next concert!");
}
else{
    console.log ("I'll keep practicing coding and racing.");
}

#3

same problem for me here (and I dont find your comments above helpful, sorry) - when I answer "who wants to race me question" with other then yes (in fact, any answer), it keeps responding "you and Bieber start racing..."
CODE:
confirm("I am ready to WIN!");
var age=prompt("how OLD r u mazafaka???");
if(age<13)
{console.log("hi there young sucker, lets start");}
else
{console.log("Turn off that computing machine and go to bed, you old fart");}
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 a pacing.'" );
}
var feedback=prompt("Rate the game from 1 till 10 please");
if (feedback>8)
{console.log("Thank you! We should race at the next concert!");}
else{
console.log("I'll keep practicing coding and racing.");}

Please help, thank you :smile:


#4

got it! should be tripple === (userAnswer==="yes")
Thanks)