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


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-x9DnD/0/5?curriculum_id=506324b3a7dffd00020bf661

No error messages or anything, but all the alerts come up before the messages are printed in the console. For example, I get asked if I want to race Bieber before it talks about Bieber asking who wants to race.

I suppose I could use alerts instead of simply logging the messages in the console, but that doesn't seem to be what we're supposed to do.


// Check if the user is ready to play!
confirm("Ready to play?");
var age = prompt("What's your age");
if (age < 13) {
    console.log("You can play, but I take no responsibility");
} else {
    console.log("Cool, 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 = confirm("Do you want to race Bieber on stage?");
if ("userAnswer" === true) {
    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.'");
}


#2

Also asked here, but no resolution.


#3

i answered it here:

The console does display while prompting?


#4

Maybe it's a browser or OS thing. I just tried it on macOS, with both Safari and Chrome, and in both cases, the messages didn't display until after the prompts.


#5

that is weird, what if you run on jsbin? select javascript and console tab, and press run js in the top right to run the code


#6

Same deal.

I tried just saving the code in a .html file and wrapping it in tags, and it actually worked as expected.


#7

you can search (using google) to see if you can find the issue

personally, i would ignore it and move on. The console is generally used for debugging, so the order of prompts and console.log is not that important


#8

Yeah, I'm just gonna take it as some funkiness of the in-site console.


#9

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