Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,250 --> 00:00:05,040
Select and const are super important.
2
00:00:05,040 --> 00:00:08,790
Another very important concept related to values
3
00:00:08,790 --> 00:00:10,590
are operators.
4
00:00:10,590 --> 00:00:13,830
For example, in JavaScript we can perform math.
5
00:00:13,830 --> 00:00:17,550
We can use the plus, minus, times,
6
00:00:17,550 --> 00:00:20,700
and division operator to perform math,
7
00:00:20,700 --> 00:00:23,733
and to, for example, divide 10 by five.
8
00:00:24,780 --> 00:00:27,030
And what's important to know about JavaScript
9
00:00:27,030 --> 00:00:30,300
is that the plus operator for adding things
10
00:00:30,300 --> 00:00:34,140
cannot just be used for numbers, as I'm doing it here.
11
00:00:34,140 --> 00:00:36,360
And the difference between numbers and strings
12
00:00:36,360 --> 00:00:38,850
is that they don't have quotes around them.
13
00:00:38,850 --> 00:00:41,460
But instead it can also be used with text.
14
00:00:41,460 --> 00:00:43,950
For example, "hello" plus "world"
15
00:00:43,950 --> 00:00:48,180
for concatenating two strings into one longer string.
16
00:00:48,180 --> 00:00:49,200
With that code,
17
00:00:49,200 --> 00:00:52,350
we would get helloworld like this as one word,
18
00:00:52,350 --> 00:00:55,860
because I have no blank anywhere in these strings.
19
00:00:55,860 --> 00:00:56,790
But as you can see,
20
00:00:56,790 --> 00:00:59,460
the plus operator works absolutely fine here.
21
00:00:59,460 --> 00:01:03,330
So you can also use it for concatenating strings.
22
00:01:03,330 --> 00:01:06,780
Now, besides plus, minus, times and division,
23
00:01:06,780 --> 00:01:09,660
you also have some other crucial operators.
24
00:01:09,660 --> 00:01:12,750
For example, the triple equal sign operator,
25
00:01:12,750 --> 00:01:15,420
which is used for checking for equality.
26
00:01:15,420 --> 00:01:19,110
And this operator therefore yields a Boolean value.
27
00:01:19,110 --> 00:01:24,110
In this case here, false, because 10 isn't equal to five.
28
00:01:24,660 --> 00:01:27,270
If I would be checking 10 equals 10,
29
00:01:27,270 --> 00:01:28,953
I instead would be getting true.
30
00:01:30,060 --> 00:01:31,920
Now, besides checking for equality,
31
00:01:31,920 --> 00:01:35,010
you can also check for things being greater or smaller
32
00:01:35,010 --> 00:01:36,240
than other things,
33
00:01:36,240 --> 00:01:40,440
or greater or equal or smaller or equal.
34
00:01:40,440 --> 00:01:43,860
And these comparison operators are also very commonly used
35
00:01:43,860 --> 00:01:44,850
in JavaScript
36
00:01:44,850 --> 00:01:47,250
and will be used a lot in this course,
37
00:01:47,250 --> 00:01:49,680
typically in conjunction with the if keyword
38
00:01:49,680 --> 00:01:51,660
and if statements,
39
00:01:51,660 --> 00:01:54,840
which allows you to execute some code conditionally.
40
00:01:54,840 --> 00:01:57,600
For example, here I'm comparing 10 to 10,
41
00:01:57,600 --> 00:02:00,060
which is kind of redundant of course.
42
00:02:00,060 --> 00:02:03,720
Typically you would instead compare some dynamic user input.
43
00:02:03,720 --> 00:02:07,350
But for this demo here, I'm using two hard coded values,
44
00:02:07,350 --> 00:02:08,910
and if this condition is met,
45
00:02:08,910 --> 00:02:11,580
which in this case here will of course always be the case,
46
00:02:11,580 --> 00:02:14,130
the code in the if statement will execute.
47
00:02:14,130 --> 00:02:17,520
But I'll get back to if statements a little bit later again.
48
00:02:17,520 --> 00:02:20,610
Here, if I reload this idea for get works,
49
00:02:20,610 --> 00:02:23,040
because of course this condition here is always met.
50
00:02:23,040 --> 00:02:25,320
Again, this is a redundant condition.
51
00:02:25,320 --> 00:02:28,800
In this course, in the apps we're going to build with React,
52
00:02:28,800 --> 00:02:31,263
you will see conditions that make more sense.
4196
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.