5.The Story Heats Up


#1

I'm sure i've typed the code right.

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.'");
}
can someone please help me and tell me if i did something wrong


#2

You put a semi colon there:

It cancels out the whole else statement, making a syntax problem.


#3

I removed the semicolon. It still says oops,try again. Did you add an if statement to your code?


#4

It may be because of the indentation. Like:

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

See the indentation? It might be different for this isn't Python, but try taking out the indentation in the brackets. Or copy paste the one above.:smiley:


#5

it still says the samething :no_mouth:


#6

Can you show me your code? Like, not in a screenshot but by copy/pasting.


#7

// Check if the user is 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"){
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

Haha I found the problem. You had to refresh. :smiley: Figures.


#9

As in just refresh the browser? I've tried that multiple times.


#10

Yeah. I did your code on mine and it worked.:smiley:


#11

Sweet I'll try that then, cheers pal


#13

Same thing here @Ragezapper.


#14

I am still getting the same error.. even changing the identation or refreshing the browser :frowning:


#15

@patrickthecodebeast and @coderunner39653, can you please show your code?


#16

I'm still in this problem too
My code
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.'")
}


#17

First, I suggest putting semi colons after the console.logs. After that, assuming that it still doesn't work, did you try copy and pasting the statement to it? If it's not exact it will not function.:smiley:


#18

Can i ask what is wrong with my code as well? I have tried all of the suggestions above and the program still doesn't let me proceed to the next step. @ragezapper


#19

There doesn't seem to be a problem with the last if loop.... maybe you can refresh, but as you have said, since you have already done that, can you show me the whole code in your editor?:smiley:


#20

Yeah this is the whole code. There's nothing else. Am i missing something? @ragezapper


#21

Yeah, I realized that. I am not able to do this one, so I invited some people. :smiley:

We'll figure this out.