1 00:00:01,410 --> 00:00:02,190 Welcome, everyone. 2 00:00:02,220 --> 00:00:09,090 Today, we going to discuss about primitive JavaScript data types in primitive JavaScript data that 3 00:00:09,420 --> 00:00:13,230 can be separated in five different categories. 4 00:00:13,620 --> 00:00:15,530 So we are going to do that. 5 00:00:15,720 --> 00:00:19,960 So I'm just going to close this one in in our Geass folder. 6 00:00:20,040 --> 00:00:24,560 Let's create an additional file called Variables the G. 7 00:00:24,790 --> 00:00:26,550 So we going to learn about variables. 8 00:00:26,740 --> 00:00:32,310 This lecture is about variables indeed at times. 9 00:00:32,500 --> 00:00:33,150 Very good. 10 00:00:33,330 --> 00:00:37,230 Now, there are five different data that's in. 11 00:00:37,230 --> 00:00:39,780 I'm just going to create multiple comments here. 12 00:00:40,080 --> 00:00:43,650 The first is a string. 13 00:00:44,340 --> 00:00:49,260 Now, that is sequence of characters used for a text. 14 00:00:49,530 --> 00:00:53,340 The second one is no, the no. 15 00:00:53,340 --> 00:00:59,660 It can be no can be like integer decimals or point numbers. 16 00:00:59,940 --> 00:01:01,080 So you will see this. 17 00:01:01,200 --> 00:01:02,100 Don't worry about it. 18 00:01:02,760 --> 00:01:12,270 The third one will be Boolean and boolean means logical, true or false in the number four will be undefined 19 00:01:13,470 --> 00:01:16,680 and you will see what undefined means in the next one will be. 20 00:01:16,680 --> 00:01:17,130 No. 21 00:01:17,340 --> 00:01:19,260 So also mean non-existent. 22 00:01:19,410 --> 00:01:25,050 So undefined is the type of variable that does not have a value yet. 23 00:01:25,440 --> 00:01:25,800 Right. 24 00:01:25,860 --> 00:01:27,620 It's a difference between now and this one. 25 00:01:27,750 --> 00:01:29,190 So I just saved that file. 26 00:01:29,490 --> 00:01:34,950 And let's do let's start working with variables. 27 00:01:34,950 --> 00:01:39,300 So the first thing you need to know is we need to create a variable. 28 00:01:39,310 --> 00:01:40,650 So how are we creating variable? 29 00:01:40,800 --> 00:01:49,890 So first we thought were in the name of the variable, for example, my first name in mine, I'm using 30 00:01:49,890 --> 00:01:53,510 Camil case, so I'm starting a lower in that. 31 00:01:53,550 --> 00:01:57,230 The second word, I'm just using the capital n right. 32 00:01:57,330 --> 00:01:58,860 That is called cavalcades. 33 00:01:58,860 --> 00:02:00,160 If you don't know, just read it. 34 00:02:00,330 --> 00:02:02,170 So the first name, let's call it here. 35 00:02:04,020 --> 00:02:08,670 I just want this one to be E in single quotes. 36 00:02:08,730 --> 00:02:11,490 Now in JavaScript you can do single or double quotes. 37 00:02:11,730 --> 00:02:13,140 Doesn't matter, it will work. 38 00:02:13,320 --> 00:02:16,590 But now most of the time she will see me single quotes. 39 00:02:16,920 --> 00:02:20,490 But if I do use double quotes, don't worry, it will still work. 40 00:02:21,200 --> 00:02:28,650 Now I have done this in so mostly one come come on case notation. 41 00:02:29,100 --> 00:02:32,460 So I have this one here as a string. 42 00:02:33,780 --> 00:02:39,470 So what we can do, we can actually cancel like this one, we can print out this values how we can do 43 00:02:39,470 --> 00:02:39,650 this. 44 00:02:39,780 --> 00:02:46,050 So can the log remember the last time you just put it on screen here, like saying blah, blah, blah, 45 00:02:46,050 --> 00:02:47,550 blah, but we're not going to do that. 46 00:02:47,760 --> 00:02:50,210 So we just going to pass in this variable here. 47 00:02:50,430 --> 00:02:52,480 So that's why we learning variables. 48 00:02:52,920 --> 00:02:53,620 Very good. 49 00:02:53,640 --> 00:03:00,390 Now, if I save this, nothing will happen because here I need to initiate the script because that is 50 00:03:00,390 --> 00:03:01,650 under a different name. 51 00:03:01,750 --> 00:03:07,850 It's called Variables Dodgiest, and I need to remove that rest of the part. 52 00:03:07,860 --> 00:03:12,000 So I do have to script and what is running after the other. 53 00:03:12,000 --> 00:03:19,860 What we have in this one is actually hello world from the external file JS file or we can say for external 54 00:03:20,640 --> 00:03:25,610 scripts, just file in. 55 00:03:25,620 --> 00:03:27,180 This one is from there. 56 00:03:27,210 --> 00:03:30,540 OK, now what I can do I can just make it. 57 00:03:30,540 --> 00:03:38,430 Here comes the lock printing the value from the variable. 58 00:03:39,360 --> 00:03:48,320 Now this is how we can, if we can create a variable and we can pass in value to this variable. 59 00:03:48,570 --> 00:03:50,460 So that is pretty much it. 60 00:03:50,820 --> 00:03:56,680 Now I do have linked this in our index of HTML. 61 00:03:56,700 --> 00:03:57,900 So if I refresh. 62 00:03:58,860 --> 00:04:01,050 So printing the value from the variable. 63 00:04:01,080 --> 00:04:03,630 Very good in the values feature. 64 00:04:03,960 --> 00:04:09,570 So if you don't want to see this actually looks kind of ugly, we're going to just comment this one 65 00:04:09,570 --> 00:04:09,810 here. 66 00:04:09,810 --> 00:04:10,920 And it's not going to work there. 67 00:04:11,220 --> 00:04:12,010 It's not going to be there. 68 00:04:12,030 --> 00:04:14,150 So Peter is the name now. 69 00:04:15,360 --> 00:04:19,080 This is from the type Sprink, right? 70 00:04:19,080 --> 00:04:21,840 Because we are passing a sequence of characters. 71 00:04:22,170 --> 00:04:29,220 Now, let's create another variable here on top and saying, OK, I just want to have old and I will 72 00:04:29,220 --> 00:04:36,480 just put a thirty three because I'm thirty three at this moment now or years or whatever you want to 73 00:04:36,480 --> 00:04:37,080 put there. 74 00:04:37,110 --> 00:04:39,610 Now I just see old in 33. 75 00:04:39,610 --> 00:04:43,080 You see this is not in single quotes or in double goals. 76 00:04:43,080 --> 00:04:55,910 That means it's, it's a number now I can just kinda like oh Ian it should give me these thirty three. 77 00:04:56,130 --> 00:04:57,930 How awesome is this is different. 78 00:04:57,930 --> 00:04:59,280 Color in mind is green. 79 00:04:59,520 --> 00:05:01,320 Your can be blue or a different color. 80 00:05:01,350 --> 00:05:03,810 Right now I have variables. 81 00:05:03,810 --> 00:05:05,310 All I have variables. 82 00:05:06,450 --> 00:05:07,130 First names. 83 00:05:07,150 --> 00:05:10,020 I have a string, I have a number. 84 00:05:10,020 --> 00:05:14,070 Now the second thing that I want to have is I'm going to say OK. 85 00:05:15,930 --> 00:05:19,350 More so check. 86 00:05:20,310 --> 00:05:24,860 No, it's like a check, I'm going to say alien, OK, this is so strange. 87 00:05:25,410 --> 00:05:33,660 So if I do it like this is going to be undefined, but I'm going to say, am I an alien, true or false? 88 00:05:33,900 --> 00:05:36,480 Because Boolean asep to values. 89 00:05:36,750 --> 00:05:43,200 So remember this, the number three is a boolean and we say, OK, the boolean, it can accept two values, 90 00:05:43,200 --> 00:05:45,120 true and false. 91 00:05:45,130 --> 00:05:47,500 So the data type can be only true or false. 92 00:05:47,670 --> 00:05:49,030 So am I alien? 93 00:05:49,380 --> 00:05:50,370 I guess not. 94 00:05:50,370 --> 00:05:50,820 I'm not. 95 00:05:50,910 --> 00:05:53,110 I'm just a normal human being, just like you. 96 00:05:53,310 --> 00:05:54,540 So calls a lot. 97 00:05:54,780 --> 00:05:55,240 Yeah. 98 00:05:55,320 --> 00:05:57,840 We just going to say alien in. 99 00:05:59,280 --> 00:06:07,050 Don't forget this one at the end, so it would give me four if you are an alien just in case and you 100 00:06:07,050 --> 00:06:08,930 put it is true, it will change. 101 00:06:09,080 --> 00:06:09,870 You need to refresh. 102 00:06:09,870 --> 00:06:10,520 It will be true. 103 00:06:10,530 --> 00:06:12,050 They're very good. 104 00:06:12,450 --> 00:06:15,720 Now, I'm just going to return back to what it was. 105 00:06:17,090 --> 00:06:21,570 Now, next one that I'm going to say it's undefined. 106 00:06:21,840 --> 00:06:28,970 So let's say, OK, so you have a first name we have or how old are you? 107 00:06:29,160 --> 00:06:30,140 You're not alien. 108 00:06:30,150 --> 00:06:33,300 And we're going to say bar and we're going to say. 109 00:06:34,690 --> 00:06:43,870 Non-value and I'm just going to not define it, because the right part of the equal operator means defining 110 00:06:43,870 --> 00:06:48,970 a value defining or a sign of that's how you call it in the programming language or everywhere you are 111 00:06:48,970 --> 00:06:51,070 signing a value to a variable. 112 00:06:51,100 --> 00:06:53,210 This is how we assign a string. 113 00:06:53,230 --> 00:06:54,620 This is how we assign a number. 114 00:06:54,790 --> 00:06:56,770 This is how we assign a boolean value. 115 00:06:56,920 --> 00:06:58,450 And so now we are undefined. 116 00:06:58,480 --> 00:07:03,270 So what we think what you think will happen if I print just non-value. 117 00:07:04,480 --> 00:07:05,140 Let's save it. 118 00:07:05,560 --> 00:07:11,600 Let's refresh, ensure it does its thing, not undefined variables. 119 00:07:11,800 --> 00:07:16,240 So this one here, it's telling me from which where it comes from. 120 00:07:16,420 --> 00:07:17,710 It's saying variables. 121 00:07:17,710 --> 00:07:21,450 The G is 20, Semco nine. 122 00:07:22,000 --> 00:07:24,610 Now that 20 is the line number. 123 00:07:25,990 --> 00:07:27,840 Right, 20 line numbers. 124 00:07:27,850 --> 00:07:30,550 I do have this line number and actually can debug it. 125 00:07:30,550 --> 00:07:33,930 Sometimes you can put a breakpoint here, but that doesn't matter. 126 00:07:33,940 --> 00:07:37,090 It's not for this lecture's or W tutorials. 127 00:07:37,360 --> 00:07:42,190 So now that is pretty much what we need to have. 128 00:07:42,200 --> 00:07:49,780 What you need to know about variables in data that I hope you enjoyed this one. 129 00:07:49,990 --> 00:07:58,660 Now you know how to assign a value here and how to assign up to a variable value so that can be streamed 130 00:07:58,660 --> 00:08:01,360 boolean undefined and unknown. 131 00:08:01,390 --> 00:08:06,570 So we've got we've got to use most of these in our practice. 132 00:08:06,790 --> 00:08:10,010 You're going to find this in some code JavaScript code. 133 00:08:10,030 --> 00:08:15,840 So I want you to know that these are basic variables, data types, and they're called primitive. 134 00:08:16,030 --> 00:08:16,400 Right. 135 00:08:16,660 --> 00:08:18,490 So they're calling the primitive. 136 00:08:22,360 --> 00:08:24,400 Primitive variable. 137 00:08:27,270 --> 00:08:34,020 But some of it is going to make it like this primitive variables and data that so if you refresh, it's 138 00:08:34,200 --> 00:08:35,250 going to be able to see it. 139 00:08:35,250 --> 00:08:35,570 Right. 140 00:08:35,820 --> 00:08:38,100 And this is how we can bring it out now. 141 00:08:38,110 --> 00:08:40,890 One more thing that you can bring out in a different way. 142 00:08:41,130 --> 00:08:46,560 So this if you don't want to use the console lock, what you can do, you can learn things. 143 00:08:46,860 --> 00:08:54,320 Alert means there will be a there will be an alert box, for example, first name. 144 00:08:54,810 --> 00:09:01,860 So here you need to pass in the variable or a screen here in order to initiate the alert. 145 00:09:02,160 --> 00:09:07,500 Now, the thing is that when the Lord is initiated, these all will be first initiated. 146 00:09:07,500 --> 00:09:09,870 And the last thing that it will come is the alert. 147 00:09:10,110 --> 00:09:11,130 And look at what's happening. 148 00:09:11,310 --> 00:09:19,420 The alert will create this sort of box when it's telling us what actually we are passing inside. 149 00:09:19,740 --> 00:09:21,630 So alert is a function here. 150 00:09:22,440 --> 00:09:24,770 You can see on top it's still spinning, right? 151 00:09:24,930 --> 00:09:31,210 It is not finished after we click, OK, it will finish because it doesn't know it. 152 00:09:31,350 --> 00:09:33,680 Wait us for an action. 153 00:09:33,870 --> 00:09:39,740 So there are a lot of different alerts and not a lot of different, but there are different alerts. 154 00:09:39,750 --> 00:09:46,630 But this is one way to print out the values or result or anything you want. 155 00:09:47,250 --> 00:09:51,450 Sometimes when the user clicks something, you want to alert them and say, OK, don't do this because 156 00:09:51,450 --> 00:09:53,540 you're going to delete this data permanently. 157 00:09:53,550 --> 00:10:00,090 That's why the alerts are there in probably going to use them in our future lectures. 158 00:10:00,240 --> 00:10:04,100 But this is how you can alert this, how you can cancel, which I prefer this one. 159 00:10:04,440 --> 00:10:11,500 There's one more when we can prompt these things from the user, but we're going to do that one. 160 00:10:11,520 --> 00:10:18,330 So now you know how to do the alert a lot and you learn about predictive variables and data types in 161 00:10:18,330 --> 00:10:18,910 JavaScript. 162 00:10:19,110 --> 00:10:19,940 So thank you very much. 163 00:10:19,950 --> 00:10:21,530 I hope you I will see you in the next one. 164 00:10:22,260 --> 00:10:23,950 Watch the videos before and after. 165 00:10:24,110 --> 00:10:25,140 Enjoy.