Why is wrong? exercise 5


#1

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

@bytesurfer27717.. can you show us your whole code... If this is your whole code.... :expressionless:


#3

Try putting a semicolon at the end of the other two console.log statements.


#4

There is no error with my code but it keeps throwing an error anyway. Can you please fix this lesson? It's very buggy and I want to complete this course without having to hack it to move on to the next part. Thanks


#5

Can you post your code and error?


#6

console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");
var userAnswer = prompt("Do you want to race Bieber on stage?");
if("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.'");
}

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


#7

Change this to

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

say it
Oops, try again. Did you add an if statement to your code? again :confused:

I dont know, I guess is a bug with exercice because the code is right.


#9

Thanks man that helped me


#10

No problem! I'm happy to have been of help to you :smile: