1
00:00:00,630 --> 00:00:02,680
Hello and welcome end this vigil.

2
00:00:02,700 --> 00:00:09,470
I will be explaining what and put this in computer programming.

3
00:00:10,200 --> 00:00:15,860
What is an input programming an input is busy.

4
00:00:15,990 --> 00:00:21,970
We all receive information from a user.

5
00:00:22,180 --> 00:00:31,620
So there are times where you may have a computer program or an application that requires some data from

6
00:00:31,620 --> 00:00:41,760
the user in order to output certain results saw the way you do with the computer does that it's by input.

7
00:00:41,860 --> 00:00:50,300
And there are different ways to input information for the computer to use.

8
00:00:50,340 --> 00:00:56,420
You may have come across some of B common input methods already.

9
00:00:56,700 --> 00:01:05,040
So things like if you may have been on a website before where you had to complete a form or put some

10
00:01:05,040 --> 00:01:15,120
details into a text box Those are methods of input because they captured the data from the user and

11
00:01:15,120 --> 00:01:26,460
then VI hastier mail and then use javascript to read the values of those inputs in to your program or

12
00:01:26,580 --> 00:01:27,570
application.

13
00:01:27,690 --> 00:01:37,890
In this field you I'm going to illustrate how an input works by using a built in function in Javascript

14
00:01:38,190 --> 00:01:48,280
is called the prompt prompt basically is used to ask questions and get some information from the user.

15
00:01:48,300 --> 00:01:58,420
So I'd be illustrating with a prompt to show you how to get some input or information from a user.

16
00:01:58,440 --> 00:02:08,310
I got my console open and I have gone to this website about quillen Blank to disclose the blank page

17
00:02:08,880 --> 00:02:15,620
that you can use to experimentor opened up the console for this page here.

18
00:02:15,930 --> 00:02:27,000
So I'm going to type in the simple prompt command is a prompt is a built in command of function in javascript

19
00:02:27,570 --> 00:02:30,830
that enables you to get some input.

20
00:02:30,840 --> 00:02:32,430
What that does it all.

21
00:02:32,430 --> 00:02:40,200
You put in the message you want it brings up an input box for the user to enter some details.

22
00:02:40,200 --> 00:02:51,450
So let us start by typing in the command which is prompt to type in P R O M prompt.

23
00:02:51,520 --> 00:03:05,340
Then you have to place inside parentheses the text that you want displayed so I can say Please

24
00:03:08,760 --> 00:03:09,540
enter

25
00:03:14,400 --> 00:03:19,340
your name or yours first.

26
00:03:21,470 --> 00:03:30,920
Name of Paul colon there because it's a string of attacks you have to enclose it in quotes.

27
00:03:30,950 --> 00:03:40,250
So this here is his complete statement here which is a command prompt there's prompt here is a javascript

28
00:03:40,550 --> 00:03:42,030
built in function.

29
00:03:42,170 --> 00:03:50,560
So this will display a pop pop come like a input box for you to enter some detail so press enter.

30
00:03:50,900 --> 00:03:52,890
And this is what it'll look like.

31
00:03:52,940 --> 00:03:54,410
He can see this text here.

32
00:03:54,410 --> 00:03:56,060
Please enter your first name.

33
00:03:56,180 --> 00:03:57,200
Nothing there.

34
00:03:57,260 --> 00:03:59,170
So I just need to enter some details.

35
00:03:59,170 --> 00:04:06,230
Like to see enter your first name to see Rick and click okay.

36
00:04:06,380 --> 00:04:14,420
And that's basically you can see here it's displayed the name here so whereby you use in it in programs

37
00:04:14,450 --> 00:04:17,960
not only is used in combination with a variable.

38
00:04:18,140 --> 00:04:24,830
So you store the values in variables and then use it later in the program or in your application.

39
00:04:24,830 --> 00:04:29,190
You can also ask questions like What is your age.

40
00:04:29,330 --> 00:04:36,240
Get a user or a visitor to enter the age in the box and then once they enter that the computer captures

41
00:04:36,280 --> 00:04:43,290
some captures that information and then uses that some way within the program or application.

42
00:04:43,340 --> 00:04:52,430
I wanna do I want to make this a bit more creative so I want to create a situation where it captures

43
00:04:52,460 --> 00:04:58,570
the information the user enters captures that input and then displays something else.

44
00:04:58,570 --> 00:05:03,950
So I'm going to clear this console by just some right click in and go in clear console.

45
00:05:04,110 --> 00:05:14,060
So while I'm going to I'm going to create a couple of variables and then is an alert box or consider

46
00:05:14,120 --> 00:05:16,650
log to display the output.

47
00:05:16,880 --> 00:05:24,890
So when I'm typing these are basically Vahn means vice shelf form four variable is a key word in Jav

48
00:05:24,890 --> 00:05:27,770
as group is used to create a variable variable.

49
00:05:27,770 --> 00:05:31,600
Basically it's a storage container where you can store data.

50
00:05:31,860 --> 00:05:33,570
Someone to quit a variable.

51
00:05:33,630 --> 00:05:44,660
I'm going to call it first name and I'm going to set that the exhaust to he is used to assign values

52
00:05:44,660 --> 00:05:53,110
to these to the variable so I'm going to set that to he was to the prompt at inside the prompt.

53
00:05:53,450 --> 00:05:57,900
I am going to see then put some quotes.

54
00:05:57,920 --> 00:06:01,960
I am going to say enter your first name

55
00:06:04,820 --> 00:06:09,390
enter first name.

56
00:06:13,210 --> 00:06:20,570
Put call on and please send me my call on the end.

57
00:06:20,730 --> 00:06:21,640
There is a tape.

58
00:06:21,700 --> 00:06:24,170
I need to let you know in the console.

59
00:06:24,190 --> 00:06:30,630
If you want to create multiple lines you hold down the shift key on your keyboard and press enter.

60
00:06:30,880 --> 00:06:37,190
And that will give you if you like I'm going to enter another variable by typing in the AH.

61
00:06:37,480 --> 00:06:40,630
And I'm going to call this variable greeting.

62
00:06:41,710 --> 00:06:42,210
Okay.

63
00:06:42,220 --> 00:06:52,240
And I'm going on a set that took me twice to do hello.

64
00:06:53,930 --> 00:07:00,040
K n do put quotes there and I'm going to do a plus.

65
00:07:00,250 --> 00:07:07,090
This is known as concatenation the plus operate it's an operator skok concatenation is basically used

66
00:07:07,090 --> 00:07:11,120
to add text or strings together.

67
00:07:11,720 --> 00:07:12,850
All right.

68
00:07:13,090 --> 00:07:16,290
So basically what this what this is doing here.

69
00:07:16,480 --> 00:07:18,760
This is a variable called first name.

70
00:07:18,750 --> 00:07:21,850
And I've said it too close to this function here.

71
00:07:21,850 --> 00:07:29,290
So what happens is the user will get a prompt say enter your first name was entered first name it will

72
00:07:29,290 --> 00:07:35,150
store that first name inside is variable called first name used in this assignment operator.

73
00:07:35,230 --> 00:07:43,770
Of course as you saw assign values to variables so to assign whatever is entered here into there and

74
00:07:43,780 --> 00:07:45,410
then they dribble here.

75
00:07:45,490 --> 00:07:48,580
I've said it to all her low blows first name.

76
00:07:48,580 --> 00:07:58,400
So for example the first name is Joe Bloggs this great in the course to helo plus job blocks away.

77
00:07:58,450 --> 00:08:00,130
The vereb was going to work.

78
00:08:00,310 --> 00:08:07,750
So now if I press Enter I'll get this alert box where it says enter your first name which is this text.

79
00:08:07,990 --> 00:08:13,450
So hour and time my first name uprose Okay.

80
00:08:13,990 --> 00:08:14,440
Okay.

81
00:08:14,440 --> 00:08:22,750
In a scene on defined because that value I've just entered it has captured it and store it inside this

82
00:08:22,990 --> 00:08:25,480
variable called first name.

83
00:08:25,480 --> 00:08:34,510
So if firewall to get the value of this variable call great in all I need to do I can make it display

84
00:08:34,510 --> 00:08:36,660
in a pop up box.

85
00:08:36,660 --> 00:08:46,240
I can just to alert and inside the premises I just type in the name of the variable which is greeting

86
00:08:48,380 --> 00:08:50,000
semicolon.

87
00:08:50,230 --> 00:08:56,520
I go to a pop up you can see here is saying hello Rick there's freakier is capture the first name I

88
00:08:56,530 --> 00:09:00,330
enter here and saved it inside this variable called first name.

89
00:09:00,330 --> 00:09:03,010
He is in this assignment operator.

90
00:09:03,310 --> 00:09:11,410
And this here this is known as concatenation is added this text hello to the value I have entered here

91
00:09:11,420 --> 00:09:13,570
that was captured which is this.

92
00:09:13,570 --> 00:09:22,340
So way you see a plus with text is known as concatenation not as a space between the hill and the rake.

93
00:09:22,540 --> 00:09:29,470
This is possible because of this base left here between this closing Quartz fire had left a space between

94
00:09:29,470 --> 00:09:33,030
the quotes the helo and the Rick will be joined together.

95
00:09:33,040 --> 00:09:35,190
So good to take note of that.

96
00:09:35,470 --> 00:09:45,930
So that's it I hope this video has been useful in illustrating how the input works or input basically

97
00:09:45,970 --> 00:09:51,360
is used to receive information from a user or is this it all.

98
00:09:51,520 --> 00:09:58,170
Normally you would have forms on the web page that users can enter information and then javascript is

99
00:09:58,180 --> 00:10:06,390
used to translate that information in to the variables within the programs.

100
00:10:06,490 --> 00:10:08,440
Then deprogrammed can use that information.

101
00:10:08,450 --> 00:10:17,250
But I've used a prompt command just to illustrate quickly had to cut short information from a user.

102
00:10:17,260 --> 00:10:19,340
Thanks for watching and bye for now.
