1
00:00:02,140 --> 00:00:04,660
Now, before we dig deeper into variables

2
00:00:04,660 --> 00:00:06,930
and different values and what we can do,

3
00:00:06,930 --> 00:00:11,210
let's talk about the general syntax of all of that again.

4
00:00:11,210 --> 00:00:14,240
You've learned about some important syntax features

5
00:00:14,240 --> 00:00:15,910
and rules already.

6
00:00:15,910 --> 00:00:19,270
For example, that there must be a white space after let

7
00:00:19,270 --> 00:00:22,370
and that let is a special keyword in JavaScript,

8
00:00:22,370 --> 00:00:24,410
which we can use to instruct the browser

9
00:00:24,410 --> 00:00:26,080
to create a variable.

10
00:00:26,080 --> 00:00:28,340
We learned that we then can store a value

11
00:00:28,340 --> 00:00:31,810
with help of the equal sign in that variable and,

12
00:00:31,810 --> 00:00:33,980
very important for that variable name,

13
00:00:33,980 --> 00:00:38,040
that it must not contain any blanks or special characters

14
00:00:38,040 --> 00:00:40,870
and that we therefore typically use this convention

15
00:00:40,870 --> 00:00:42,750
for giving it a name.

16
00:00:42,750 --> 00:00:44,940
The difference between a rule and a convention

17
00:00:44,940 --> 00:00:47,870
is that a convention is not a must to do,

18
00:00:47,870 --> 00:00:49,570
a rule on the other hand is.

19
00:00:49,570 --> 00:00:51,750
So it's a rule to not have blanks,

20
00:00:51,750 --> 00:00:55,212
but a convention to then use this camelCase notation

21
00:00:55,212 --> 00:00:58,320
for assigning that name.

22
00:00:58,320 --> 00:01:02,140
You could also set it to greeting texts like this,

23
00:01:02,140 --> 00:01:05,170
starting with a capital G, that would be valid,

24
00:01:05,170 --> 00:01:07,280
it would not violate any rules,

25
00:01:07,280 --> 00:01:09,740
but it would be against this convention.

26
00:01:09,740 --> 00:01:13,570
So that's why I'm following it with a lowercase G.

27
00:01:13,570 --> 00:01:16,310
Now another syntax feature,

28
00:01:16,310 --> 00:01:18,870
which you will see in a lot of JavaScript code,

29
00:01:18,870 --> 00:01:21,990
including my JavaScript code from now on

30
00:01:21,990 --> 00:01:24,863
is that lines end with a semi colon.

31
00:01:25,800 --> 00:01:28,250
It's actually not a must to do,

32
00:01:28,250 --> 00:01:30,380
as you can clearly tell by the fact

33
00:01:30,380 --> 00:01:33,660
that this code worked without issues,

34
00:01:33,660 --> 00:01:36,440
but it is something which is often done.

35
00:01:36,440 --> 00:01:40,313
It's done to clearly mark, where a line of code ends.

36
00:01:41,420 --> 00:01:43,240
Now, of course you could say, well,

37
00:01:43,240 --> 00:01:46,470
obviously the line ends where it ends,

38
00:01:46,470 --> 00:01:48,900
but theoretically, in JavaScript,

39
00:01:48,900 --> 00:01:52,700
you are allowed to have multiple commands in one line,

40
00:01:52,700 --> 00:01:55,870
but without a semi-colon you would get an error,

41
00:01:55,870 --> 00:01:56,960
as you can tell.

42
00:01:56,960 --> 00:02:00,420
If I add a semi-colon here, that would work again.

43
00:02:00,420 --> 00:02:02,840
Now it's not considered a good practice

44
00:02:02,840 --> 00:02:06,530
to put multiple instructions into one line though.

45
00:02:06,530 --> 00:02:08,759
And therefore you typically should split them across

46
00:02:08,759 --> 00:02:10,300
multiple lines and hence,

47
00:02:10,300 --> 00:02:12,760
you can omit semi-colons.

48
00:02:12,760 --> 00:02:15,710
Nonetheless, since we must use semi-colons

49
00:02:15,710 --> 00:02:18,410
in many other programming languages,

50
00:02:18,410 --> 00:02:20,930
and since you must use them in JavaScript

51
00:02:20,930 --> 00:02:24,370
if we had multiple instructions in the same line,

52
00:02:24,370 --> 00:02:27,791
it's often seen that people do use semi-colons

53
00:02:27,791 --> 00:02:29,300
after every line,

54
00:02:29,300 --> 00:02:31,400
even if they do split their code

55
00:02:31,400 --> 00:02:34,000
across multiple lines correctly.

56
00:02:34,000 --> 00:02:37,850
And it's also something, a certain programming style,

57
00:02:37,850 --> 00:02:39,920
which I like to follow and therefore,

58
00:02:39,920 --> 00:02:43,610
I also put semi-colons at the end of each line,

59
00:02:43,610 --> 00:02:45,590
but it's technically not required

60
00:02:45,590 --> 00:02:47,350
and you don't have to do it,

61
00:02:47,350 --> 00:02:50,700
but if you don't do it, you should never do it.

62
00:02:50,700 --> 00:02:54,520
So again, be consistent, just as with the quotes.

63
00:02:54,520 --> 00:02:56,010
You can create strings

64
00:02:56,010 --> 00:02:58,630
with double or single quotes around them,

65
00:02:58,630 --> 00:03:02,240
but you should be consistent once you've made a decision.

66
00:03:02,240 --> 00:03:04,430
And here I will be consistent

67
00:03:04,430 --> 00:03:06,800
and I will be using semi-colons

68
00:03:06,800 --> 00:03:08,703
at the end of every code line.

