5.The Story Heats Up

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

1 Like

You put a semi colon there:

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

1 Like

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

1 Like

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:

1 Like

it still says the samething :no_mouth:

1 Like

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

1 Like

// 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’”);
}

2 Likes

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

2 Likes

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

1 Like

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

1 Like

Sweet I’ll try that then, cheers pal

1 Like

Same thing here @Ragezapper.

1 Like

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

1 Like

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

1 Like

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.’”)
}

1 Like

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:

1 Like

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

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:

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

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

We’ll figure this out.