I'm stuck in part 4


#1


I'm stuck with this problem but i don't see anything wrong with my code. can someone tell me what a my missing.


Replace this line with your code.


#2

would you mind sending a link to the assignment? Also if you could copy and paste your code that would help me out a little bit.


#4

on your first if statement, you have a string for "age is less than 13" but you aren't supposed to have a string. its supposed to be if(age < 13)


#5

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

Check if the user is ready to play!
confirm(" Are you ready to play")
var age = prompt("How old are you my good friend?");
if("age is less than 13")
{ console.log("Your to young, will let you play but i most warn you theres graphic contect") }
else
{ console.log("Your the type of people we're looking for. Welcome my friend.") }
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("If they say YES")
{ console.log("Get ready, said, GO") }
else
{ console.log("Next time i guess!") }


#6

Ok fix it, what else i have going on wrong.


#7

so your suddenly Bieber console log is not exactly what the instructions are asking for. so when the error that says Oops, try again. Did you remember to console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'"); ? copy and paste the exact text for the whole console log statement and paste it. this worked for me with your code.


#8

make sure you don't get the ? at the end.


#9

you are genius it work. i don't know it didn't before but it did. thanks 100%


#10

also your if statement at the end says if("if they say yes") if statements almost never check strings. the proper way to check what the answer is from the user would be if( userAnswer === "yes")


#11

no problem, but I still am working out some problems on it. with the fixed if statement I just mentioned it says that there is a missing ; and I cant find it. I will post the updated code.


#12

//Check if the user is ready to play!
confirm(" Are you ready to play");
var age = prompt("How old are you my good friend?");
if(age < 13){
console.log("Your too young, i'll let you play but i must warn you there's graphic content");
}else{
console.log("Your the type of people we're looking for. Welcome my friend.");
};
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("Get ready, said, GO");
}else{
console.log("Next time i guess!");
};


#13

the code that worked for you will pass the instructions but its not actually working. you don't have to fix it if you don't want to but ill help you if you do. either way is fine with me.


#14

oh I just figured it out, the first line wasn't a comment so it messed everything up and the suddenly Bieber this went back to being wrong. otherwise it works perfectly fine. if you are ok with the answer then click the solved box and it will show everyone that this post is already fixed.


#15

https://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/6?curriculum_id=506324b3a7dffd00020bf661
Take a look at it now is coming pretty well so far. Fix it up. what you think?

// Check if the user is ready to play!
confirm(" Are you ready to play")
var age = prompt("How old are you my good friend?");
if(age < 13)
{ console.log("Your to young, will let you play but i most warn you theres graphic contect") }
else
{ console.log("Your the type of people we're looking for. Welcome my friend.") }
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?");
var userAnswer = ("yes")
if( userAnswer)
{ 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 our game from 1 to 10. 1 being the worst and 10 being the best.")
if (feedback > 8)
{ console.log("Thank you! We should race at the next concert!") }
else
{console.log("I'll keep practicing coding and racing.") }


#16

it looks really good except for the two var user answers. you don't want to just set it as yes, you want to check if its yes and then do something. so if you remove the second var userAnswer and change your if statement to if( userAnswer === "yes") { then it should work better.


#17

its just personal preference but for if statements I usually set it up like this
if(){

}else if{

}else{

}
where the curly braces are at the start and finish of each line. the way you are doing it is fine but its just a little less neat. just letting you know.
your code looks really good though, keep it up and before you even realize it you will be the one helping others out on here.


#18

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