Hello and welcome end this vigil.
I will be explaining what and put this in computer programming.
What is an input programming an input is busy.
We all receive information from a user.
So there are times where you may have a computer program or an application that requires some data from
the user in order to output certain results saw the way you do with the computer does that it's by input.
And there are different ways to input information for the computer to use.
You may have come across some of B common input methods already.
So things like if you may have been on a website before where you had to complete a form or put some
details into a text box Those are methods of input because they captured the data from the user and
then VI hastier mail and then use javascript to read the values of those inputs in to your program or
application.
In this field you I'm going to illustrate how an input works by using a built in function in Javascript
is called the prompt prompt basically is used to ask questions and get some information from the user.
So I'd be illustrating with a prompt to show you how to get some input or information from a user.
I got my console open and I have gone to this website about quillen Blank to disclose the blank page
that you can use to experimentor opened up the console for this page here.
So I'm going to type in the simple prompt command is a prompt is a built in command of function in javascript
that enables you to get some input.
What that does it all.
You put in the message you want it brings up an input box for the user to enter some details.
So let us start by typing in the command which is prompt to type in P R O M prompt.
Then you have to place inside parentheses the text that you want displayed so I can say Please
enter
your name or yours first.
Name of Paul colon there because it's a string of attacks you have to enclose it in quotes.
So this here is his complete statement here which is a command prompt there's prompt here is a javascript
built in function.
So this will display a pop pop come like a input box for you to enter some detail so press enter.
And this is what it'll look like.
He can see this text here.
Please enter your first name.
Nothing there.
So I just need to enter some details.
Like to see enter your first name to see Rick and click okay.
And that's basically you can see here it's displayed the name here so whereby you use in it in programs
not only is used in combination with a variable.
So you store the values in variables and then use it later in the program or in your application.
You can also ask questions like What is your age.
Get a user or a visitor to enter the age in the box and then once they enter that the computer captures
some captures that information and then uses that some way within the program or application.
I wanna do I want to make this a bit more creative so I want to create a situation where it captures
the information the user enters captures that input and then displays something else.
So I'm going to clear this console by just some right click in and go in clear console.
So while I'm going to I'm going to create a couple of variables and then is an alert box or consider
log to display the output.
So when I'm typing these are basically Vahn means vice shelf form four variable is a key word in Jav
as group is used to create a variable variable.
Basically it's a storage container where you can store data.
Someone to quit a variable.
I'm going to call it first name and I'm going to set that the exhaust to he is used to assign values
to these to the variable so I'm going to set that to he was to the prompt at inside the prompt.
I am going to see then put some quotes.
I am going to say enter your first name
enter first name.
Put call on and please send me my call on the end.
There is a tape.
I need to let you know in the console.
If you want to create multiple lines you hold down the shift key on your keyboard and press enter.
And that will give you if you like I'm going to enter another variable by typing in the AH.
And I'm going to call this variable greeting.
Okay.
And I'm going on a set that took me twice to do hello.
K n do put quotes there and I'm going to do a plus.
This is known as concatenation the plus operate it's an operator skok concatenation is basically used
to add text or strings together.
All right.
So basically what this what this is doing here.
This is a variable called first name.
And I've said it too close to this function here.
So what happens is the user will get a prompt say enter your first name was entered first name it will
store that first name inside is variable called first name used in this assignment operator.
Of course as you saw assign values to variables so to assign whatever is entered here into there and
then they dribble here.
I've said it to all her low blows first name.
So for example the first name is Joe Bloggs this great in the course to helo plus job blocks away.
The vereb was going to work.
So now if I press Enter I'll get this alert box where it says enter your first name which is this text.
So hour and time my first name uprose Okay.
Okay.
In a scene on defined because that value I've just entered it has captured it and store it inside this
variable called first name.
So if firewall to get the value of this variable call great in all I need to do I can make it display
in a pop up box.
I can just to alert and inside the premises I just type in the name of the variable which is greeting
semicolon.
I go to a pop up you can see here is saying hello Rick there's freakier is capture the first name I
enter here and saved it inside this variable called first name.
He is in this assignment operator.
And this here this is known as concatenation is added this text hello to the value I have entered here
that was captured which is this.
So way you see a plus with text is known as concatenation not as a space between the hill and the rake.
This is possible because of this base left here between this closing Quartz fire had left a space between
the quotes the helo and the Rick will be joined together.
So good to take note of that.
So that's it I hope this video has been useful in illustrating how the input works or input basically
is used to receive information from a user or is this it all.
Normally you would have forms on the web page that users can enter information and then javascript is
used to translate that information in to the variables within the programs.
Then deprogrammed can use that information.
But I've used a prompt command just to illustrate quickly had to cut short information from a user.
Thanks for watching and bye for now.