The order of the game is messed up


I finished coding the adventure according to the exact instructions, but when I run the code, it first pops all the confirms and prompts, and then after the "rate us" prompt, it logs on the console all the things i wrote... there is no logical order for the game. (for example - only after the user rate the game, he can see what the game was about and why i asked him if he want to race bieber).

confirm("Let The Games Begin!");
var age=prompt("How old are you?");
if (age<13)
{console.log("You are not allowed to play 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?");
if (userAnswer==="yes")
{console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!")}
{console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")}
var feedback=prompt("Please rate us on a scale of 1-10");
if (feedback>8)
    console.log("Thank you! We should race at the next concert!")
    console.log("I'll keep practicing coding and racing.")


Hmm that is weird, when I run your code it works fine and is in the right order. After each prompt it logs a string to the console as expected. Maybe try running it again in a different browser?


thanks! in internet explorer it works but in chrome it doesn't.


Great, glad that sorted it out.


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