All prompts before console.log?


#1




No error message here, everything was coded according to the directions. However, in the later stages of the project, all the prompt commands are called prior to any console.log commands being printed. Even prompt commands later in the code are called before even the first console.log command prints something. Then in the end, all the console.log commands have their outputs printed all at once, after all the prompts have been completed y the user.

This makes for a lousy game. No one else has had this problem?


// Check if the user is ready to play!
confirm("Ready to play?")

var age = prompt("Enter your age");

if(age<14){
console.log("I take no responsibility for your deliquency");
}else{
console.log("OK! You are " + age +" years old, so you say.");
}

//begin the game: descipr the scene:
var intro = "You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'";

console.log(intro);

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.'");
}

//get user feedback
var feedback = prompt("Rate the game from 0 to 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

Make sure you use if statements. If you have already, make sure that the console.log statement prints after you answer your first "prompt" question.


#3

Thanks for responding, I've edited the original post to include the code.