The story heats up!


#1


I am facing a small issue in the Code your own adventure game.
The code runs fine no problems but here is what my issue is:

1.First the code gives a prompt saying "I'm ready to play".
2.Then it asks for a prompt "What's your age?".
3.Then based on the user input it displays a message.
4.Next ideally it should display the console.log output as the story "You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'"

But it asks for the next prompt ie. "Do you want to race Bieber on stage?" and once i give the input then only it displays the story.

Please let me know what I am missing because the flow of the game is not correct here.


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


I have posted my entire code till now below:


// Check if the user is ready to play!
confirm("I'm ready to play");
var age = prompt("What's your age?");
if(age<13)
{
    console.log("Play at your own risk!!");
}
else 
{
    console.log("Wooohaha! Lets Begin!");
    }
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.'");
    }


#2

I got your point, You're saying execution of code and the messages aren't synchronized. I just tested it on browser and It works fine but at CC's it shows story after the last part of code as you mentioned.
Probably one of the glitch in CC's interpreter.
(or say this is designed this way?)


#3

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