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


#1


// Check if the user is ready to play
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

Hi bavemulain

You see in the console.log you have (it's) you can't put ( ' ) because it is the same as putting commas ( " " )

console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!") ;


#3

Hi Peter, Swapnil here.
I've written the code as I mentioned below, though it is showing an error: "Oops, try again. Did you add an if statement to your code?", I can't figure out what's wrong is there in the code. Please help. Thanks.


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



#4

Having same problem here ;//


#5

Hi Swapnil sorry for super late reply been away first of all you are missing semi colons here

console.log ("You and Bieber start racing. It's neck and neck! You win by a shoelace!")

and here

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


#6

A post was split to a new topic: Did you add an if statement to your code?


#7

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