5.The Story Heats Up


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

I am stuck at 5.The Story heats up!


After I make an entry in the dialog box and I try to Save and Submit my code, this is what I get:

Oops, try again.
    Did you add an if statement to your code?
  

#2

please post your code and a url to the exercise :grinning:


#3

Just post everything :grin:


#4

I am also getting the same error. Code is given below

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


#5

The problem is in the second “if, else”. You have to put double quotation before and after yes instead of single quotation. I’m not that experienced in Java but I think it’s because single quotation is for Char(single character) and double quotation is for String.

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

That’s not the issue. There is no difference between single quotes and double quotes in this issue. The issue is in the same bold area, but you have made three ='s instead of two which is used in if-statements.
Fix this and try again


#7

You need to leave the code used from the beginning or else you´ll still have problems. just copy and paste my code.

console.log(“You are at a Justin Bieber concert, and you hear this lyric ‘Lace my shoes off, start racing.’”);// do this code
console.log(“Suddenly, Bieber stops and says, ‘Who wants to race me?’”);// do this code
var userAnswer=prompt(“Do you want to race Bieber on stage?”);
if (true) {
console.log(“You and Bieber start racing. It’s neck and neck! You win by a shoelace!”);
} else { // Otherwise…
console.log(“Oh no! Bieber shakes his head and sings ‘I set a pace, so I can race without pacing.’”);
}
var feedback = prompt(“Message”);
if(feedback > 8){
console.log(“Thank you! We should race at the next concert!”);
}else{
console.log(“I’ll keep practicing coding and racing.”);
}


#8

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