1
00:00:00,260 --> 00:00:09,290
Before we talk about the couple of ways of assigning values to variables, let's revisit the data types

2
00:00:09,290 --> 00:00:13,100
by exploring each of these types with code.

3
00:00:13,250 --> 00:00:17,150
So back to Visual Studio code over here.

4
00:00:17,150 --> 00:00:26,420
We are going to start with the primitive data types and it's going to be as this and I want to change

5
00:00:26,420 --> 00:00:27,980
the color to red.

6
00:00:28,250 --> 00:00:35,120
An example of the primitive data type, as we spoke about, is called string.

7
00:00:35,330 --> 00:00:40,520
And this is how it goes to declare a variable with a string value.

8
00:00:40,550 --> 00:00:48,500
It goes like this, like I said, that we are going to stick to const and let without using var.

9
00:00:48,740 --> 00:00:56,630
So for this I will say let full name is equal to John Doe.

10
00:00:57,620 --> 00:01:05,280
And as you can see, the way I'm naming my variables and we have a couple of ways to name variables,

11
00:01:05,280 --> 00:01:11,460
don't worry, we have a section to talk about the best practices or naming conventions.

12
00:01:11,460 --> 00:01:15,300
But for the meantime, just type the way I'm doing it.

13
00:01:15,300 --> 00:01:20,820
But the key note here is that your variable name must not have space in it.

14
00:01:20,820 --> 00:01:25,140
Again, we have a video to talk about the best way to declare variables.

15
00:01:25,140 --> 00:01:28,320
For the meantime, just follow along the way.

16
00:01:28,440 --> 00:01:37,020
As you can see, we have store a value of string inside full name and this is a string simply because

17
00:01:37,020 --> 00:01:46,410
we are using quotes around it and you can use double quotes or single quotes around it and it is the

18
00:01:46,410 --> 00:01:46,980
same.

19
00:01:46,980 --> 00:01:55,800
So if I go ahead and console log the full name, we're going to see John Doe inside the console.

20
00:01:55,800 --> 00:01:59,940
And as you can see, we have John Doe over here.

21
00:01:59,940 --> 00:02:02,040
So this is how a string.

22
00:02:02,280 --> 00:02:07,050
Then the next type of data is called the number.

23
00:02:08,120 --> 00:02:15,020
And we can declare a variable, for example, account number or account balance.

24
00:02:15,020 --> 00:02:17,690
So let me say account balance.

25
00:02:19,920 --> 00:02:22,950
Is equal to, let's say, 200.

26
00:02:22,950 --> 00:02:27,000
So I'm saving a number into a variable.

27
00:02:27,000 --> 00:02:34,920
So if I console log the account balance, we are going to see the 200.

28
00:02:34,950 --> 00:02:35,880
Save it.

29
00:02:35,880 --> 00:02:37,410
And there we go.

30
00:02:37,410 --> 00:02:46,440
We have 200 and I can access the account balance as that and I can also access the full name because

31
00:02:46,440 --> 00:02:53,670
now we have saved these values inside the internal memory of JavaScript.

32
00:02:53,790 --> 00:03:02,490
The next type of data is called Boolean, as we have spoke about, and this one holds only two values,

33
00:03:02,490 --> 00:03:04,680
whether true or false.

34
00:03:04,680 --> 00:03:10,050
So here I can say let is married.

35
00:03:10,050 --> 00:03:11,940
Meaning are you married?

36
00:03:11,970 --> 00:03:16,560
Then it can be false or true.

37
00:03:16,650 --> 00:03:21,700
So if I make it a false meaning, you are not married.

38
00:03:21,910 --> 00:03:22,330
All right.

39
00:03:22,330 --> 00:03:26,650
So if you check inside the console and I set four is married.

40
00:03:27,040 --> 00:03:31,270
As you can see, we have a value of false.

41
00:03:31,540 --> 00:03:35,680
Then the next type of data is called null.

42
00:03:36,070 --> 00:03:38,050
And it goes like this.

43
00:03:38,050 --> 00:03:40,270
Let me add a comment by saying.

44
00:03:41,200 --> 00:03:42,010
Let.

45
00:03:43,050 --> 00:03:47,550
Pending transaction is equal to null.

46
00:03:48,670 --> 00:03:49,510
Save it.

47
00:03:49,510 --> 00:03:57,660
And if you check inside the browser by searching for pending transaction, as you can see, we have

48
00:03:57,670 --> 00:04:10,930
value of Null and the next type is called undefined and I can declare a variable as country and is equal

49
00:04:10,930 --> 00:04:13,310
to undefined.

50
00:04:13,330 --> 00:04:21,760
So what is the differences between undefined and narrow, both null and undefined?

51
00:04:21,790 --> 00:04:31,000
In JavaScript they represent absence of value, but they are used in slightly different circumstances.

52
00:04:31,150 --> 00:04:39,790
For example, for undefined, it is a variable that has been declared, but it has not been assigned

53
00:04:39,790 --> 00:04:44,440
a value and by default it will give you undefined.

54
00:04:44,650 --> 00:04:53,920
And now, on the other hand is an assigned value, meaning it can be assigned to a variable that represents

55
00:04:53,950 --> 00:05:01,810
no value or no object, and it implies an empty or nonexistent value.

56
00:05:01,810 --> 00:05:09,400
So at this point, take it that they are all absence of values when a variable is being declared, but

57
00:05:09,400 --> 00:05:12,700
they have some differences in some situations.

58
00:05:12,700 --> 00:05:16,840
The next type of data type is called the symbol.

59
00:05:16,840 --> 00:05:25,720
So our other comment here by saying symbol and this is a new feature and we are not going to use this

60
00:05:25,720 --> 00:05:26,740
one in this course.

61
00:05:26,740 --> 00:05:27,790
But let me show you.

62
00:05:28,090 --> 00:05:30,700
I will say let unique.

63
00:05:32,210 --> 00:05:41,720
ID equal to symbol, bring the uppercase symbol and then pass in the ID, something like this.

64
00:05:41,720 --> 00:05:47,000
And if you log the unique ID here.

65
00:05:48,720 --> 00:05:51,890
As you can see where I think I need to type it.

66
00:05:51,900 --> 00:06:01,350
Well, let me clear it as unique value or unique ID, And we have this symbol and we are not going to

67
00:06:01,350 --> 00:06:04,890
use this one in this course because it's not commonly used.

68
00:06:04,920 --> 00:06:09,000
Now let's talk about the non primitive types.

69
00:06:09,000 --> 00:06:16,590
So I will go ahead and put it here as non primitive data types.

70
00:06:16,590 --> 00:06:27,230
And one example is the object and object are used to store multiple data about a single entity.

71
00:06:27,240 --> 00:06:29,040
So it goes like this.

72
00:06:29,040 --> 00:06:33,480
Let and I want to provide more data about a user.

73
00:06:33,480 --> 00:06:39,810
And for this one too, we have a section to talk about object functions, strings and others.

74
00:06:39,810 --> 00:06:44,700
But for the meantime, I just want to show you the different types of data types.

75
00:06:44,700 --> 00:06:54,400
And for this it goes like key value pair and if I want to save the first name about a user and I'll

76
00:06:54,400 --> 00:07:01,810
provide as John, it's supposed to be colon but not equal to then comma.

77
00:07:01,810 --> 00:07:05,740
And if I want to save the last name.

78
00:07:06,400 --> 00:07:14,560
And I will say, though, as you can see for this one, we can save multiple data in a single value

79
00:07:14,560 --> 00:07:15,430
or variable.

80
00:07:15,430 --> 00:07:21,550
And I will say 30 if I go ahead and console log the user here.

81
00:07:21,580 --> 00:07:25,510
We have all the properties as they stand right now.

82
00:07:25,540 --> 00:07:31,870
Don't worry about objects If you are new to programming, I just want to show you how it looks like

83
00:07:32,020 --> 00:07:36,850
and the next type of primitive data type is called array.

84
00:07:36,880 --> 00:07:40,420
Again, we have a section to talk about array.

85
00:07:40,420 --> 00:07:43,030
So let me show you an example of code.

86
00:07:43,030 --> 00:07:44,710
And it goes like this.

87
00:07:44,710 --> 00:07:53,740
And for this I want to declare a variable called transactions amount and is equal to array like that

88
00:07:53,740 --> 00:08:02,230
and provide the values here as that so I can save multiple values inside arrays.

89
00:08:02,230 --> 00:08:10,070
So if I search for transactions amount as you can see, these are the values inside them.

90
00:08:10,070 --> 00:08:13,010
And lastly, it's about functions.

91
00:08:13,040 --> 00:08:17,210
Again, don't worry about these ones because these are advanced topics.

92
00:08:17,210 --> 00:08:21,530
I just want to show you the syntax and example of each of the data types.

93
00:08:21,530 --> 00:08:33,799
So here I will say let greet user and as arrow function and inside here I can go ahead and console log.

94
00:08:33,830 --> 00:08:35,059
Good morning.

95
00:08:37,080 --> 00:08:37,679
Great.

96
00:08:37,679 --> 00:08:38,370
Save it.

97
00:08:38,370 --> 00:08:47,400
And inside the console here, if I look for great user and call the function as that I have.

98
00:08:47,430 --> 00:08:48,420
Good morning.

99
00:08:48,750 --> 00:08:51,090
At this point, don't worry about the syntax.

100
00:08:51,090 --> 00:08:56,880
If it looks confusing, we have a specific section to dive in more, but the purpose for this video

101
00:08:56,880 --> 00:09:01,560
to show you examples of each of the primitive data types.

102
00:09:01,740 --> 00:09:02,220
All right.

103
00:09:02,220 --> 00:09:07,560
The next video we will have a look at the best way for naming variables.

