Keep getting the same error: "Did you remember to put in the 'yes' answer option?"


#1


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

I cannot seem to find error in this, but keep getting the same error message "Did you remember to put in the 'yes' answer option?"

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.");
}
else {
console.log("Oh no! Bieber shakes his head and sings.");
}


Replace this line with your code.


#2

it might have to do with the amount of = you have in the if statement. one = assigns a value, two == checks the value of something but not the data type (like a "string" compared to a number) and three === checks the data type and value. so if you had
if( "1" == 1) {

}
it would pass. but if you had
if("1" === 1) {

}
you the if statement wont run because the condition wasn't met..
I would just delete an equal sign and check if it works.


#3

Kalebmfratello, thank you. I tried taking out an "=", but I get the same result. Any other suggestion? I appreciate your input.


#4

for some reason the code worked just fine for me even before you took out an equal sign. I'm not sure whats happening but maybe try using a different browser or something. ill keep looking and see if I find anything that doesn't look right.


#5

what did the error message say the second time for you?


#6

Here is the message I got, "Oops, try again. Did you add an if statement to your code?" The code looks ok, but not working as expected or keeps giving the message.
Thank you for your advice.


#7

this is getting pretty confusing and frustrating to me because the code works on my computer but not yours. plus I cant see anymore problems with the code. did you try changing browsers? If that doesn't work it could always be a bug. in that case, could you send your current code and ill see if I can get it to pass.


#8

Try redoing the if statement.


#9

Having the exact same issue, my code:

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 shoeloace!");
} else {
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}

No matter what variation of "yes" that I put in, it just keeps telling me : "Oops, try again. Did you remember to put in the 'yes' answer option?"

At least if there were glitches with the other lessons, there was the automatic 'get code option' and also 'report bug' option...


#10

Well and deleted and re-wrote my entire if/then statement and now it passed. I'm assuming there was some typo that was unrelated to the yes part, but it wasn't able for whatever reason to tell me exactly what it really was incorrect. This was what I typed second time btw.

if (userAnswer === "yes") {
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
} else {
console.log("On no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}


#11

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