Game sequence error


#1

The game I have programmed doesn't keep the same sequence of steps. I have to answer the prompts before anything is written in the log. First I'm asked if I'm ready to play, then my age, then if I want to race, then to rate the game. All of this happens before I get the storyline in the console.log. Anybody else?


#2

@ego_relay Post your code here so we can take a look at it. Maybe something is just out of order.


#3

I have the same problem.
My code looks like this;

console.log("Are you ready to play?");
confirm("Let's go already.");
var age = prompt("What's your age?");
if (age >= 13) {console.log("You are permitted to play this game at your own risk.")}
else {console.log("Sorry Squirt you'll have to grow up.")};
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("Please rate this game out of 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.")};


#4

//answer:
// Check if the user is ready to play!
var init = confirm("Are you ready to play this game ?");
var age = prompt("What's your age ?");

if(age < 13) {

console.log("You can play but I take no responsibility.");

} else {

console.log("You are Ready To play!");

}
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" || userAnswer === "Yes") {
console.log("You and Bieber start racing.");
}
else {
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}
var feedback = prompt("can you rate this game ? rate 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.");
}


#5

your answer gives the wrong sequence too.


#6

I had the same problem - wrong sequence - too. I wonder maybe it happens because of codecademy prompt. Could anybody else share your experience. After running your code what the sequence is?


#7

I am also having the exact same issue. The Codecademy accepts my code and says to continue to the next section, however all of the "game" prompts come before any text is logged.


#8

Searching through the closed topics with the same problem. I found the post where it was advised to substitute all the console.log() by either confirm() or alert(). I did it. It works weird as pop ups, but it works. If somebody has better solution, please share.