Right solution but i have problem


#1

when i press no i have the result but when i have press yes i have the two answers and it must just one
// Check if the user is ready to play!
var age = prompt("what is your age");
if ( age < 13 )
{
console.log("you can play but in your responsibility");
} else {
console.log("you can play on!");
}
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?")
console.log(userAnswer)
if( userAnswer ==="yes")
{
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}
else ( userAnswer==="no")
{ console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}


#2

Hi the else statemnt deosn't need of the condition so remove it

else ( userAnswer==="no")

#3

Change your last else to an else if. Else takes no condition and runs if nothing else in the if statement is true.


#4

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