I am stuck in "The story heats up!", pls help


#1

Please help me, find the error, why it says " Oops, try again. Did you add an if statement to your 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 shoelace!");
}else {  
    console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
    }


#2

You didnt compare if(userAnswer ="yes") here you declare userAnswer with the value = yes.
Change that


#3

yes, I changed, but it says same thing.. :unamused:
I tried to attached a screen shot of my code, it is not uploading.


#4

Okay than copy and paste it here ?!


#5

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.'");
}


#6

where is the rest of your code? You need the age prompt with the if/else statement from the earlier exercise + the race justin bieber on stage if/else in order to pass


#7

hi dr,
this is my full code, but it also not working, become a same error, unfortunately I couldn't attach the screen shot of my code with error,

// Check if the user is ready to play!
confirm("I understand confirm!");
var age = prompt("What's your age");
var userAnswer = prompt ("Do you want to race Bieber on stage?");

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


#8

this is my code

Uploading...


#9

But where i your code is this part

if(age < 13){
    console.log("You can play but we will dont take responsibility!");
} 
else {
    console.log("So go on and play this fantastic Game!");
}

Without this you only have on if/else and the Interpreter will give you an error


#10

thanks a lot, I really missed that, I did not care about previous code. thanks again. :relaxed: