What is prompt?


#1

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?");

https://www.codecademy.com/courses/getting-started-v2/1/4?curriculum_id=506324b3a7dffd00020bf661

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.


#2

you mean browser asks you those questions.

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


#3

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

but with 2 prompts its giving only last prompt ans.


#4

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 (.


#5


#6

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?


#7

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.


#8

_Javascript_ by default will show the last entered value**


#9

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


#10

Advice*

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


#11

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