The story heats up! 5/7 script.js


#1

Oops, try again. There was a problem with your syntax.

<Below this line, add a link to the EXACT exercise that you are stuck at
https://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/5?curriculum_id=506324b3a7dffd00020bf661#
this line, in what way does your code behave incorrectly? Include ALL error messages.>
// Check if the user is ready to play!
confirm(" Are you ready to Play!")
var age = prompt("what is your age")
if( age <= 13)
{
console.log("You can play");
}
else
{
console.log("You can not 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?");
//var userAnswer = "yes";
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.'");
}


`




Result


The Box Model



Image courtesy of www.w3.org!




#2

Hello,

You have to take a look again at your

if( userAnswer = "yes");

You are comparing it to a string, which means that you have to modify your comparison operator '='. You have to see it as it's 'equal to' yes.


#3

I do not believe there should be a semi colon after your if condition.
if( userAnswer = "yes")


#4

Thanx. I replaced it by ===.


#5

And after removing the semicolon after the condition if ( userAnswer ="yes") it worked. Thanx


#6

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