Justin Bieber Game: No error bu jumping storyline


#1

Hi.

I do not know what I missed here because it does not prompt any error.
I even completed the coding of the game and it worked finely except for one thing... the storyline jumps like this:

  1. Question if ready to play
  2. Question on player's age
  3. Question if player wants to race with Justin Bieber
  4. Request for feedback
  5. Whole narrative shows at once (texts about the introduction, the story, and the response re feedback).

Here's the code I used:

// Check if the user is ready to play!
confirm("Are you ready to play?");
// Check player age.
var age = prompt("How young are you?");
// Insert disclaimer if less than ideal age.
if(age < 13)
{
console.log("My dear, I will not kick you out but if you continue to play the game, I take no responsibility for you. Sorry. :(")
}
else
{
console.log("Just the right age! Let's beging this aweeeesome game!")
}
// Set up the scene for your story.
console.log(" ")
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("Kindly rate this 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.")
}


#2

if i run your code, it does show the output while the prompts are showing:


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

why is the lines showing only after the prompts finish?


#4

the lines? Its unclear which lines you are referring to. As you can see in the screenshot, i don’t have that problem, so very likely its caused by some browser behaviour on your side. Often input fields are used, not prompt, so its no big deal


#5

Hello. I have the same problem as @reut1990, the messages will not show up until I have answered all the questions. i have tried it in different browsers too :confused:


#6

#7

This topic is really old, make a new topic as stated in the guidelines

also check this topic:

on how to write a good post, this will help us much better to help you, from which you profit