5/7 Oops, try again. Did you remember to put in the 'yes' answer option?


#1

// Check if the user is ready to play!
confirm("Are you ready to play?");
var age = prompt("How old are you?");
if(age < 13)
{
console.log("You can play but I can't take any responsibilty!"); }
else { console.log("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 and Bieber start racing. It´s neck and neck! You win by a shoe lace!")
}else{
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")
}

What exactly did I do wrong?


#2

I think it is because you put:

if (userAnswer === "yes")

When it should be:

if (userAnswer == "yes")

I could be wrong as my knowledge is JavaScript is a bit rusty.


#3

No, it specifically says "Remember: = is for assignment, and === is to check if things are equal!" so it's not that.
I have no idea what's going on because I'm running into the same issue.


#4

remove the space in the word shoe lace. I just did that and it solved the problem. if not, try and see how the spacing and opening/closing in your code are.


#5

I got into the same issue here. It doesn't display the exact error or what else needs to do..
It always ends up with this "Did you remember to console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'"); ?"
I used this if (userAnswer = "yes")


#6

You forgot to add the ; to the end of your console log expressions.


#7

Hello guy's

just run into the same problem after messing a bit around for myself i found the solution.

// Check if the user is ready to play!
confirm("Are you ready to play!?");
var age = prompt("what's your age?");
if(age <13)
{
console.log("You are to youngh")//do this code
}
else //"otherwise"
{
console.log("Allright let's play!") //do this code
}
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 yes = "yes" //yes needs to be decleard as a variable
if(prompt === 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.'");
}

Good luck whit the rest of the course! :smile:


#8

Can you please fix this course. It really sucks how buggy it is. There is absolutely nothing wrong with my code but it keeps giving errors. The browser console says there are 3 errors on the page too.


#9

/*if you use == or === this mean is equal 8*1 == 8 and this mean is identical 8 ===8*/
// ther is no error if use === to asig to "yes" string
// Check if the user is ready to play!
var init = confirm("Are you ready to play this game ?");
var age = prompt("What's your age ?");

if(age < 13) {

console.log("You can play but I take no responsibility.");

} else {

console.log("You are Ready 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?'");
var userAnswer = prompt("Do you want to race Bieber on stage?");

if (userAnswer === "yes" || userAnswer === "Yes") {
console.log("You and Bieber start racing.");
}
else {
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}
var feedback = prompt("can you rate this game ? rate 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.");
}