1
00:00:00,450 --> 00:00:01,560
Hello and welcome.

2
00:00:01,590 --> 00:00:07,590
In this video I'll be showing you some variable naming convention.

3
00:00:07,620 --> 00:00:14,690
These are basic rules that you need to follow when giving you a variable names.

4
00:00:14,700 --> 00:00:17,570
So I'm just going to read through this table.

5
00:00:17,640 --> 00:00:25,860
So the first thing to take into account is that variable names cannot start with numerical.

6
00:00:25,860 --> 00:00:28,560
For example you can't use a number.

7
00:00:28,560 --> 00:00:34,310
You can name a variable 3 x or 4 cars just for example.

8
00:00:34,410 --> 00:00:37,230
Those would be illegal variable names.

9
00:00:37,230 --> 00:00:41,530
However you can combine the numbers with text.

10
00:00:41,610 --> 00:00:47,490
You can call a variable maybe cars for or go for it and things like that.

11
00:00:47,550 --> 00:00:50,920
They are perfectly valid variable names.

12
00:00:51,300 --> 00:00:54,230
You cannot use operators operators.

13
00:00:54,300 --> 00:01:02,350
I mean either mathematical or logical operators you can't use that in variable names.

14
00:01:02,340 --> 00:01:04,080
For example you can't call a variable.

15
00:01:04,080 --> 00:01:14,490
This plus that or this minus that or these times that you can do that you can not to use any point suasion

16
00:01:14,520 --> 00:01:22,830
marks of any kind in a javascript variable name other than the on the scope.

17
00:01:22,890 --> 00:01:31,190
So you can't call your variable car core loan or car hash but you can use an underscore underscore is

18
00:01:31,200 --> 00:01:31,710
allowed.

19
00:01:31,740 --> 00:01:38,270
So you can give a variable name on the score car for example or something on the score something or

20
00:01:38,280 --> 00:01:48,180
thing that is allowed javascript variable names most never contain spaces never for example you can't

21
00:01:48,540 --> 00:01:53,190
name your variable my car space car that's not allowed.

22
00:01:53,190 --> 00:01:57,360
However you can give it my car that is legal.

23
00:01:57,360 --> 00:02:05,070
There cannot be any spaces between variable names variable names are case sensitive.

24
00:02:05,070 --> 00:02:13,680
For example if you declare a variable called My car is different from a variable called my car or my

25
00:02:13,680 --> 00:02:14,130
car.

26
00:02:14,160 --> 00:02:16,550
They are all different variations.

27
00:02:16,550 --> 00:02:19,960
So when you declare variable names you've got to be careful.

28
00:02:20,130 --> 00:02:27,150
In the case you use so that when you want to refer to that variable name you are referencing the correct

29
00:02:27,390 --> 00:02:28,350
variable.

30
00:02:28,350 --> 00:02:31,150
It's like having the key to the wrong door.

31
00:02:31,320 --> 00:02:34,800
If you don't have the right key you will not be able to open the door.

32
00:02:35,160 --> 00:02:41,160
So you must make sure you have your variable names correct in the correct case.

33
00:02:41,160 --> 00:02:47,490
Finally you cannot use any java script key words.

34
00:02:47,490 --> 00:02:52,920
Key words are parts of the javascript language itself.

35
00:02:52,920 --> 00:02:55,180
You cannot use any of that for variable name.

36
00:02:55,470 --> 00:02:59,900
For example window is a keyword in JavaScript.

37
00:02:59,910 --> 00:03:01,090
Part of the language.

38
00:03:01,170 --> 00:03:06,180
Things like open as part of the language location or string.

39
00:03:06,180 --> 00:03:09,110
Those are all part of the javascript language.

40
00:03:09,120 --> 00:03:12,510
So it will be illegal to use them on their own.

41
00:03:12,510 --> 00:03:22,410
However you can use them in combination with other things or or key words for example you can call a

42
00:03:22,410 --> 00:03:33,420
variable that window or maybe my string or whatever you can combine them with other text that is acceptable.

43
00:03:33,440 --> 00:03:40,860
So these are just some key basic rules you need to take into consideration when you are keeping your

44
00:03:40,860 --> 00:03:42,450
variable names.

45
00:03:42,450 --> 00:03:44,040
That's it for this video.

46
00:03:44,040 --> 00:03:45,630
Thank you for watching.

47
00:03:45,630 --> 00:03:46,620
Bye for now.
