The 'else' condition run after the 2nd variable


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
First Move of Code your own Adventure

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
My code runs fine if the age variable is above 13. But if the age variable is less than 13, it doesn’t run the else part, instead, it runs the next variable directly, “do you want to race Bieber”, then it goes back to run the else part from what’s your age, “You are welcome to play the game but we take no responsibility.” Very strange ? Anyone has encountered the same thing and can help?


confirm ("I am ready to play!")
var age = prompt ("what's your age?")
if (age<13) {console.log("You're allowed to play the game but we take no responsibility")}
else {
    console.log("Go on! Hope you enjoy the game!")}
    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?")

#2

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