1
00:00:00,690 --> 00:00:01,650
Hello and welcome.

2
00:00:01,650 --> 00:00:10,220
In this video I will be explaining what an input is in computer programming.

3
00:00:10,290 --> 00:00:21,720
What is an input programming an input is basically a way of receiving information from a user.

4
00:00:22,200 --> 00:00:31,650
So there are times where you may have a computer program or an application that requires some data from

5
00:00:31,650 --> 00:00:36,640
the user in order to output certain results.

6
00:00:36,660 --> 00:00:47,430
So the way the way the computer does that is by input and there are different ways to input information

7
00:00:47,550 --> 00:00:50,340
for the computer to use.

8
00:00:50,370 --> 00:00:56,480
You may have come across some of the common input methods already.

9
00:00:56,730 --> 00:01:04,830
So things like a phone you may have been on a Web site before where you had to complete a form or input

10
00:01:04,830 --> 00:01:07,740
some details into a text box.

11
00:01:07,740 --> 00:01:18,150
Those are methods of input because they captured the data from the user and then by hasty e-mail and

12
00:01:18,150 --> 00:01:28,650
then use javascript to read the values of those input into your program or application in this video.

13
00:01:28,650 --> 00:01:39,420
I'm going to illustrate how an input works by using a built in function in javascript is called the

14
00:01:39,420 --> 00:01:40,290
prompt.

15
00:01:40,450 --> 00:01:48,270
The prompt basically is used to box questions and get some information from the user.

16
00:01:48,330 --> 00:01:58,350
So I'd be illustrating with a prompt to show you how to get some input or information from a user.

17
00:01:58,440 --> 00:02:07,440
I have got my console open and I have gone to this Web site about column blank so that basically is

18
00:02:07,450 --> 00:02:11,150
a blank page that you can use to experiment.

19
00:02:11,160 --> 00:02:15,960
So I've opened up the console for this page here.

20
00:02:15,960 --> 00:02:18,620
So I'm going to tie pin.

21
00:02:18,930 --> 00:02:28,950
The simple prompt command is a prompt is a built in command or function in javascript that enables you

22
00:02:28,980 --> 00:02:30,900
to get some input.

23
00:02:30,900 --> 00:02:39,240
What that does it all you put in the message you want it to bring up an input box for the user to enter

24
00:02:39,240 --> 00:02:40,230
some details.

25
00:02:40,230 --> 00:02:54,330
So let me start by typing in the command which is prompt to typing P R O M prompt and then you have

26
00:02:54,330 --> 00:03:05,340
to place inside the parentheses the text that you want displayed so I can just say Please

27
00:03:08,820 --> 00:03:09,170
enter

28
00:03:14,430 --> 00:03:28,310
your name or your first name up or call on there because it's a string or a text.

29
00:03:28,310 --> 00:03:30,880
You have to enclose it in quotes.

30
00:03:30,980 --> 00:03:40,250
So this here is a complete statement here which is a command a prompt this prompt here is a javascript

31
00:03:40,620 --> 00:03:41,660
building function.

32
00:03:42,200 --> 00:03:50,350
So this will display a pop up com like input box for you to enter some detail so press enter.

33
00:03:50,930 --> 00:03:52,980
And this is what it will look like.

34
00:03:53,000 --> 00:03:55,840
You can see this text here Please enter your first name.

35
00:03:56,240 --> 00:03:57,280
That's it there.

36
00:03:57,290 --> 00:04:06,200
So I just need to enter some details so I just say enter your first name just see Rick and click OK.

37
00:04:06,410 --> 00:04:08,160
And that's basically it you can see here.

38
00:04:08,210 --> 00:04:11,330
It's displayed the name here.

39
00:04:11,330 --> 00:04:17,860
So whereby you're using it in programs normally is used in combination with a variable.

40
00:04:18,170 --> 00:04:24,860
So you'll store the values in variables and then use it later in the program or in your application.

41
00:04:24,860 --> 00:04:29,210
You can also ask questions like What is your age.

42
00:04:29,360 --> 00:04:33,410
Get a user or visitor to enter that age in the box.

43
00:04:33,410 --> 00:04:40,340
And then once they enter that computer captures some captures that information and then uses that some

44
00:04:40,340 --> 00:04:47,850
way within the program or application or I want to do I want to make this a bit more creative.

45
00:04:47,870 --> 00:04:55,760
So I want to create a situation where it captures the information the user enters captures our input

46
00:04:56,270 --> 00:04:58,550
and then displayed something else.

47
00:04:58,550 --> 00:05:02,910
So I'm gonna clear this console by just right clicking and going.

48
00:05:02,910 --> 00:05:03,760
CLAIRE console.

49
00:05:04,150 --> 00:05:13,910
So what I'm going to do I'm going to create a couple of variables and then is an alert box or console

50
00:05:13,960 --> 00:05:16,910
or log to display the output.

51
00:05:16,910 --> 00:05:25,320
So when typing V are basically via means far is short form for variable is a key word in JavaScript.

52
00:05:25,340 --> 00:05:31,430
It is used to create a variable variable basically as a storage container where you can store data.

53
00:05:31,910 --> 00:05:41,470
So I'm going to create a variable and I'm going to call it first name and I'm going to set that the

54
00:05:41,530 --> 00:05:48,710
course to here is used to assign values to this to the variable so I'm going to set that to quote to

55
00:05:49,570 --> 00:05:53,340
the prompt inside the prompt.

56
00:05:53,500 --> 00:06:02,000
I'm going to say I'm going to put some quotes and I'm going to say enter your first name

57
00:06:04,850 --> 00:06:08,390
and first name.

58
00:06:12,570 --> 00:06:13,210
OK.

59
00:06:13,250 --> 00:06:20,090
Port call on and I for my call on the end.

60
00:06:20,750 --> 00:06:26,690
There is a tape I need to let you know in the console if you want to create multiple lines you hold

61
00:06:26,690 --> 00:06:33,440
down the shift key on your keyboard and press enter and that will give you a few lines I'm going to

62
00:06:33,500 --> 00:06:42,630
enter another variable by typing a V R and I'm going to call these variable greeting okay and I'm going

63
00:06:42,630 --> 00:06:47,780
to set that to a course to do.

64
00:06:47,840 --> 00:06:48,700
Hello.

65
00:06:53,420 --> 00:06:54,720
Okay.

66
00:06:54,770 --> 00:07:00,200
And to put quotes there and I'm going to do a plus.

67
00:07:00,260 --> 00:07:07,130
This is known as concatenation the plus operate is an operator's code concatenation is basically used

68
00:07:07,130 --> 00:07:11,940
to add text or strings together.

69
00:07:12,020 --> 00:07:12,980
All right.

70
00:07:13,130 --> 00:07:16,380
So basically what this what this is doing here.

71
00:07:16,520 --> 00:07:18,550
This is a variable called first name.

72
00:07:18,800 --> 00:07:21,800
And I've said it too of course to this function here.

73
00:07:21,860 --> 00:07:23,950
So what happens.

74
00:07:23,960 --> 00:07:29,780
The user will get a prompt is they enter your first name once they enter the first name it will store

75
00:07:29,780 --> 00:07:35,840
the first name inside this variable called first name used in this assignment operator equals two is

76
00:07:35,840 --> 00:07:38,990
used to assign values to variables.

77
00:07:39,110 --> 00:07:46,650
So it will assign whatever is entered here into there and then this variable here I've set it to close

78
00:07:46,730 --> 00:07:48,610
to her low plus first name.

79
00:07:48,610 --> 00:07:52,640
So for example the first name is Joe Bloggs.

80
00:07:52,640 --> 00:07:57,240
This greeting will of course to Hello plus Joe Bloggs.

81
00:07:57,430 --> 00:08:00,340
So that's the way the variable is going to work.

82
00:08:00,350 --> 00:08:07,010
So now if I press enter I will get this a lockbox where it says enter your first name which is this

83
00:08:07,010 --> 00:08:07,960
tax.

84
00:08:08,030 --> 00:08:08,550
So.

85
00:08:08,600 --> 00:08:11,560
And Tom my first name.

86
00:08:11,570 --> 00:08:12,250
Press.

87
00:08:12,470 --> 00:08:13,530
OK.

88
00:08:14,030 --> 00:08:14,500
OK.

89
00:08:14,500 --> 00:08:21,530
You know saying on defined because that probably you have just entered it is captured and stored it

90
00:08:21,560 --> 00:08:25,520
inside this variable called first name.

91
00:08:25,520 --> 00:08:34,490
So if I want to get the value of this variable called greeting all I need to do I can make it display

92
00:08:34,520 --> 00:08:36,670
in proper box.

93
00:08:36,770 --> 00:08:46,210
I can just to alert and inside the parentheses I just typed in the name of the variable which is greeting

94
00:08:48,190 --> 00:08:54,150
and semicolon and go to a pop up you can see here is saying hello Rick.

95
00:08:54,150 --> 00:08:59,710
The trick here is capture the first name I entered here and saved it inside this variable called first

96
00:08:59,710 --> 00:09:00,460
name.

97
00:09:00,580 --> 00:09:03,020
Using this assignment operator.

98
00:09:03,340 --> 00:09:04,500
And this here.

99
00:09:04,750 --> 00:09:08,430
This is known as concatenation is added this text.

100
00:09:08,500 --> 00:09:11,430
Hello to the value of entered here.

101
00:09:11,440 --> 00:09:13,600
That was captured which is this.

102
00:09:13,600 --> 00:09:18,500
So anyway you see a plus with text is known as concatenation.

103
00:09:18,640 --> 00:09:25,540
Notice as the space between the halo and the Rick this is possible because of the space of left here

104
00:09:25,540 --> 00:09:27,290
between these closing quotes.

105
00:09:27,550 --> 00:09:33,040
If I hadn't left the space between the courts the halo and the Rick will be joined together.

106
00:09:33,070 --> 00:09:35,390
So it's good to take note of that.

107
00:09:35,510 --> 00:09:36,640
So that's it.

108
00:09:36,640 --> 00:09:46,720
I hope this video has been useful in illustrating how the input works or input basically is used to

109
00:09:46,720 --> 00:09:51,190
receive information from a user or a visitor.

110
00:09:51,550 --> 00:09:58,180
Normally you would have forms on a web page that he uses can enter information and then javascript is

111
00:09:58,180 --> 00:10:07,720
used to translate that information into the variables within the programs and then the program can use

112
00:10:07,720 --> 00:10:08,490
that information.

113
00:10:08,490 --> 00:10:16,840
But I've used a prompt command just to illustrate quickly how to capture information from a user.

114
00:10:17,290 --> 00:10:19,180
Thanks for watching and bye for now.
