What is prompt?


in 9th exercise I am facing problem with prompt.
In that I have to write 2 line with prompt command.
but on screen only last answer is coming.("what is ubantu?");


prompt("what is your name?");
prompt ("what is ubantu?");

what is problem I cant find.
Please healp.
In first question I have written jagrut. and "null" is printing.


you mean browser asks you those questions.

you do not see an answer because you do not store the answer to any variable


But when I use only single prompt its giving write answer.

but with 2 prompts its giving only last prompt ans.


You need to assign your prompt's returned result to a variable, like so:

var age = prompt("How old are you");

Also notice the spacing between prompt and (.



It says that you need to ask the user where they are from, so that would require one prompt, maybe that's the problem?

Anyway, it looks like you've finished this exercise already somehow, so why don't you just go to the next one?


The answer would be (since the instructions require the user's native country):

prompt("Where are you from?");

You'll then get a pop-up in which you can answer said question.


_Javascript_ by default will show the last entered value**


The lesson don't allow that, this is bad advise



It should allow that, as that's what it's asking for from what I can see.


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