The story heats up. Syntax error help!


#1


Help!! I don't know where the error is in the last if/else statement


// Check if the user is ready to play!
confirm("ARE YOU READY!!!");
var age = prompt("WHAT's UR AGE");
if (age < 13) {
    console.log("WE SHALL NOT TAKE ANY RESPONSIBILITY OF WHAT YOU HEAR OR SEE")
}
else {
}
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{
    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

This should be a condition

that evaluates if the user's answer is yes or no not just,

if userAnswer

something like,

if (userAnswer === "yes")


#3

If userAnswer is what?


#4

`
// Check if the user is ready to play!

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

Please let me know whats wrong with my code . . it always says whether i have used f else block


#5

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