5. The story heats up!


#1

why dosent this work?

var age =13
var age = prompt("What's your age")

if (age < 13)
{
console.log("You can play with us but we take no resposibility!")
}
else
{
console.log("Awesome lets play on!")
}
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'")

//story line
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 can race without pacing.'")
}


The story heats up
#2

You don't have any semicolons in here.
JavaScript requires you to enter a semicolon at the end of each statement.
I'm curious what happens when you run this. Do you get an error message?


#3

You must make sure to use the same exact text strings from the instructions provided:

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

Your quote here is not the same. They want this:

"Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'"


#4

yes i realised after and did correct it, but i still got the same error.
I had to skip the code and start the next one for it to run without any errors. Weird?!
thanks :slight_smile:
the error was something to do with the "yes" command...
did you remember to put in the "yes" in the prompt?? something like that?
it was doing my head, but got around it:)


#5

the error was something to do with the "yes" command...
did you remember to put in the "yes" in the prompt?? something like that?
it was doing my head, but got around it:)


#6

Glad you worked it out :slight_smile:


#7

thanks for your input. :wink:


#8

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