All the prompts appear before the console logs


So I don't actually have an error message, but all of the prompts appear before the text in the console does. I get asked if I want to race Bieber right after I'm asked my age, and THEN I get the story

// Check if the user is ready to play!

confirm("Are you ready?");

var age = prompt("How old are you?");

if(age<13) {
    console.log("Aren't you a bit too young to be playing games like these? ......... Oh, well.");

else {
    console.log("Let's do this!");

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!");

else {
    console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");

var feedback = prompt("Out of ten, how much did you like the game?");

if (feedback>=8){
    console.log("Thank you! We should race at the next concert!");

else {
    console.log("I'll keep practicing coding and racing.");

I don't know how to make things work in a certain order other than to put them in order in the code? Thanks in advance for the help guys


Console doesn't print out messages until after all the prompts are done

Your code executes from the top working its way down
The output is just being held back somewhere, nothing to do with your code


Ok thanks, I was worried I did something wrong there :slight_smile:


I think I understand, that the code is all good, since I could successfully Save and Submit. But is there a way to see the console logs before the prompts?


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