[SOLVED] Prompt Menus Before Console can display its logs


#1

Hey!
I completed this part of the course without too much difficulty. However, why do the prompt menus come up one after each other without giving time for someone to read the text. I have tried using pause/sleep commands and functions but they don't seem to work. Any ideas? I would like to practice and try different things with this minigame.

Cheers!

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

var age = prompt("What's your age");


if (age < 13) {
     console.log("You're allowed to play, but you take no responsibility!");
}
   else
{
     console.log("Game On! :D");
}

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("Rate the game out of 10 please!")

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

Have you tried a google search
javascript timer site:stackoverflow.com
https://stackoverflow.com/questions/29971898/how-to-create-an-accurate-timer-in-javascript


#3

Hi,

Cheers for this link Leonhard! A few changes to the code and it works perfectly.
I'm spending way to much time in this minigame. Its looking great! x).

Sorry for the late reply, I work Monday to Friday 9am to 5:30pm, training to be an IT Manager, and only a few hours a day to learn web developing, my work wants me to be a web developer as well. :slight_smile:

Cheers Again,

Ben.


#4

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