5. Story heats up- i cant find the problem


#1

I cant find any problem in this code. I used Polish console.log prints

// Check if the user is ready to play!
confirm("are you ready to play?")
var age =prompt("Ile masz lat?")
if(age<13)
{
console.log("Sory nie możesz grać jesteś za młody")
}
else
{
console.log("no to jedziemy")
}
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 pacing.'")
}


#2

Hi, had the same problem. Copy paste this to the second line of your code and it should work:

// if ( condition ) {
// IF-codeblock
// }
// else {
// ELSE code block
// }


#3

It should look like this
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 pacing.'")
}


#4

Hello, where are the semicolons after parenthesis ?


#5

Yup codewhiz71790 is right! Need to put those semicolons in after the parenthesis.

Like this:

// Check if the user is ready to play!

confirm("are you ready to play?");
var age = prompt("Ile masz lat?");

if (age<13)
{
console.log("Sory nie możesz grać jesteś za młody");
}
else
{
console.log("no to jedziemy");
}


#6

My code looks the same and I'm also getting the output when then conditions are true and false but it still says " Oops, try again. Did you add an if statement to your code? "


#7

Guys ,
they want you to put the whole exercise from the beginning, including the "Are you ready to play?" and the age check, like this (feel free to copy paste, of course):

// Check if the user is ready to play!
confirm("I'm ready to play");
var age = prompt("Whats your age?");
if (age < 13){
console.log("GTFO kid");
} else {
console.log("Welcome!");
}
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 pacing.'");
}


#8

This answer is correct


#9

fixed the problem . .. .
is it a bug ?