Prompt Pop up windows


#1

For my interactive game all of the prompt windows show up one after another before the user has a chance to read any of the text. How can I delay the prompts? Help please!

Here is my code:

// Check if the user is ready to play!
confirm("Are you ready to play?");

var age = prompt("And you are how old, sir?");

if(age<13)
{
console.log("Okay, you are allowed to play but I take no responsibility if you get annihilated by monsters and other terrible creatures of the universe. Be warned............. but not really, this is just about Bieber.");
}
else
{
console.log("We have determined that you are of appropriate age. Play on.");
};

//introduction
console.log("\nYou are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");

console.log("\nSuddenly, Bieber stops and says, 'Who wants to race me?'\n")

var userAnswer = prompt("\nDo 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!\n");
}
else
{
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}

var feedback = prompt("Rate this game on a scale of 1 - 10.");
if(feedback>8)
{
console.log("Thank you! We should race at the next concert!");
}
else
{
console.log("I'll keep practicing coding and racing.");
}


#2

This has come up before. I think that it happens in a particular browser.

What operating system and browser are you using?

If we can get this sorted, we should make an FAQ for this question.


#3

Hi :slightly_smiling: I'm using MAC OS X Lion (upgrading tonight so I should try my code after the upgrade). I tried Safari and Chrome.


#4

I just gave this a try on OS X. Chrome and Firefox behaved normally, Safari gave me all the prompts before displaying any messages.