Having a few problems with Code Your Own Adventure


I'm on step 5, or The Story Heats Up! (https://www.codecademy.com/en/courses/javascript-beginner-en-x9DnD/0/5?curriculum_id=506324b3a7dffd00020bf661).

confirm("I am ready to play!")
var age = prompt("What's your age?");
if ("What's your age?" < 13) {
console.log("Fine, go ahead, but I'm not responsible.");}
else { console.log("Go have fun!");}
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 race, and you win by a mile! Good job!")} else {console.log("He shakes his head and walks away, saying 'Your loss.'");}

Maybe you already see my problem, but I'm having issues with the age question and with the endgame. With the age, I always get "Go have fun" regardless of the age I put in, but I set it so it will only say that if the value is less than 13. The program is still running, but I'd like to know why it does that.

And with the end, when it asks if I want to race Bieber, I respond with yes, but I continually receive an error message that tells me to use the 'yes' response, preventing me from moving forward to the next lesson. SOLVED

Any ideas on why these two things are happening? Thanks


On this line, you should be checking if age is less than 13. That's why you had a prompt on the previous line, to have the user input a number to assign to age.

The text strings in these console.log statements, do they match the ones from the instructions?


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