Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:00,660 --> 00:00:01,060
All right.
1
2
00:00:01,080 --> 00:00:02,280
Welcome back guys.
2
3
00:00:02,310 --> 00:00:08,280
In the last lesson we saw how we could use the alert keyword in javascript to create a pop up in our
3
4
00:00:08,280 --> 00:00:15,420
browser and the pop up would say whatever is in between the two round brackets. In this case it would
4
5
00:00:15,420 --> 00:00:16,510
be Hello.
5
6
00:00:16,740 --> 00:00:25,020
Now how does the browser know which part of this code is actual code i.e. keywords like alert and which
6
7
00:00:25,020 --> 00:00:29,240
parts of this line is the text that we want to display?
7
8
00:00:29,460 --> 00:00:36,210
Well there’s something that we've added here that tells the browser that this is a string, and the secret
8
9
00:00:36,300 --> 00:00:42,360
is of course these two little quotation marks because everything that they enclose gets interpreted
9
10
00:00:42,360 --> 00:00:50,240
by the computer as a string so that it gets taken out of the code and gets interpreted as text.
10
11
00:00:50,280 --> 00:00:56,400
And this is really important because all the code that we write is written with text, right, with characters
11
12
00:00:56,490 --> 00:00:57,940
in the English alphabet.
12
13
00:00:58,230 --> 00:01:04,700
And it's really important that the computer knows which parts are the code and which parts are the text.
13
14
00:01:04,830 --> 00:01:10,500
And this is a great place to introduce you to something called data types because a string is exactly
14
15
00:01:10,500 --> 00:01:10,860
that.
15
16
00:01:10,920 --> 00:01:12,380
It's a data type.
16
17
00:01:12,480 --> 00:01:19,610
It's a way of classifying data to tell the computer how the program intends to use the data.
17
18
00:01:19,650 --> 00:01:24,960
In this case it's simply the text that we want to be displayed in our pop up and you will see this data
18
19
00:01:24,960 --> 00:01:30,030
type across all programming languages and it's pretty much always called a string.
19
20
00:01:30,270 --> 00:01:36,070
And that's because it's simply a string of characters just as you would have a string of pearls.
20
21
00:01:36,240 --> 00:01:42,090
And in the coming lessons whenever I refer to string I'm always talking about text that's not meant
21
22
00:01:42,090 --> 00:01:46,070
to be interpreted as code or just a string of characters.
22
23
00:01:46,080 --> 00:01:49,340
Now there are other data types other than strings.
23
24
00:01:49,470 --> 00:01:55,140
For example there are numbers, and numbers, because they have different symbols from the alphabet than
24
25
00:01:55,140 --> 00:01:56,760
we use for code,
25
26
00:01:56,920 --> 00:02:01,330
then we don't actually need any special symbols to tell the computer that this is a number.
26
27
00:02:01,350 --> 00:02:07,350
We can just simply type the number. And finally, the last data type I want to show you is the boolean.
27
28
00:02:07,410 --> 00:02:12,190
And this is the data type that describes data that is either true or false.
28
29
00:02:12,240 --> 00:02:18,090
And we're going to be using a combination of all of these data types in order to create the programs
29
30
00:02:18,180 --> 00:02:21,020
and the web sites in the coming lessons and modules.
30
31
00:02:21,090 --> 00:02:26,750
So this really is the groundwork and it's the fundamentals of how all programming languages work.
31
32
00:02:26,790 --> 00:02:29,330
So let's take a look at this in more detail.
32
33
00:02:29,340 --> 00:02:35,580
I want you to open up your console so you can do that by going to View, Developer, Javascript Console,
33
34
00:02:35,760 --> 00:02:38,490
and you'll see it show up down here. And, in the console,
34
35
00:02:38,490 --> 00:02:43,400
you can do a number of things. So you can, for example, add numbers to each other.
35
36
00:02:43,410 --> 00:02:46,140
So 2 + 3 equals 5.
36
37
00:02:46,140 --> 00:02:52,470
And you get an output after you hit enter. You can also write the code that we wrote before which is the
37
38
00:02:52,560 --> 00:02:59,610
alert keyword and that tells the browser that we want a pop up that says the output of 2 + 3.
38
39
00:02:59,610 --> 00:03:03,100
So once I hit enter I will get a pop up that says 5.
39
40
00:03:03,150 --> 00:03:06,210
Now I want to show you another keyword other than the alert,
40
41
00:03:06,240 --> 00:03:08,070
and this is called typeof.
41
42
00:03:08,160 --> 00:03:14,670
And this actually tells you what is the data type of whatever it is that you put within these round
42
43
00:03:14,670 --> 00:03:15,240
brackets.
43
44
00:03:15,330 --> 00:03:21,050
So, for example, if I put 23 in here, then I will get the output of,
44
45
00:03:21,060 --> 00:03:29,010
this is a number, but if I wrote something like typeof my name inside some quotation marks, then I
45
46
00:03:29,010 --> 00:03:31,400
get told that this is a string.
46
47
00:03:31,440 --> 00:03:38,490
And finally, let's just, for completion sake, use a boolean, for example true, then I get told that this
47
48
00:03:38,490 --> 00:03:39,920
is a boolean.
48
49
00:03:39,930 --> 00:03:45,510
So in the coming lessons and modules we'll be using all of these different data types in order to create
49
50
00:03:45,570 --> 00:03:51,000
our web sites and web apps. And understanding the fact that different pieces of data can have different
50
51
00:03:51,000 --> 00:03:55,240
data types will be a foundation block towards building those web sites and web apps.
51
52
00:03:55,290 --> 00:04:00,570
Now, in the next lesson we're going to talk about another foundation block for all programming languages,
52
53
00:04:00,900 --> 00:04:02,510
which is the variable.
53
54
00:04:02,520 --> 00:04:05,610
So for all of that and more, I’ll see you on the next lesson.
6112
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.