Console Displays only after all prompts are answered?


#1

So I just want to check with others to see if you have the same output. My code clears when I check "Save and Submit", but when the code runs all my prompts appear before the story is displayed in the small console screen. So you do not understand the context of the prompts.

Is this how it is supposed to work. I know this may not be the purpose of the lesson, but is just seems like bad form for creating something an end user would want, so what is the point of that?

Either way, are others having the same experience with their output, or did I miss something?

Replace this line with your code.


#2

You could replace all console.log(); with confirm();
Although I'm not sure if that is a correct way of solving your problem.


#3

Almost, this solves the first problem, with confirm it does throw up a prompt from the first if else statement, but in the console you do not see any of the responses till the code runs to the end. I am looking for a way to make the code and console run at the same time - to be interacive.

Here is my code so far:

var age = prompt("What's your age");
if( age < 13 )
{
confirm("You may play at your own risk :(");
}
else
{
confirm("Let's 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" )
{
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 the game 1 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

This is happening for me as well - is it maybe something to do with the console? Because the code looks right to me.


#5

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