Improve the game


#1

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

I have a question.
My code is correct and I have finished the course, but I wanted to make some changes to my game.
I have noticed that all the prompt appear one by one on the top of the page, I answer them, and only then, when i have finished answering all the prompts,all the sentences console.log appears at the same time on the black screen on the right.

That’s not logical.

How can I do if I want it all to appear in that way:

  1. prompt(“Quel âge as-tu ?”) appear

  2. then, the good sentence of the if/else statement appear
    "Tu peux jouer mais je me dégage de toute responsabilité !“
    or
    "C’est parti !”

  3. the next consoles.logs
    "You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing."
    “Suddenly, Bieber stops and says, 'Who wants to race me”

  4. then the Prompt(“Do you want to race Bieber on stage?”)

  5. then the console.log,

  6. etc.

Sorry for my english, i’m trying improving it. Tell me if you don’t understand.



confirm("Prêt à jouer ?");
var age = prompt("Quel âge as-tu ?");
if (age < 13) {
    console.log("Tu peux jouer mais je me dégage de toute responsabilité !");
}
else {
    console.log("C'est parti !");
}

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

var feedback = prompt("rate my game between 0 and 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

Yeah, same issue here, how can you get the console to return portions without running all the prompts first?


#3

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