Why this code doesn't work?


#1

In this task I wrote this code:

var userAnswer = confirm("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.'")
}

It should work, but it doesn't. Once I submit it I get the message: "Oops, try again.
Did you add an if statement to your code?". I don't know what to do?


#2

you need this + the age prompt with the if/else statement to check the age from the previous exercise in order to pass.

This code should have been in the editor when you started this exercise


#3

var userAnswer = confirm("Do you want to race Bieber on stage?");

you need to use prompt not confirm , prompt will ask the user and allow him to answer, and if the answer matches your comparison on

if(userAnswer === 'yes'){

}

it will run!

theres not a confirm thing