1 00:00:01,160 --> 00:00:07,220 So let's take a look at some data type examples have copied our starter program, and the first thing 2 00:00:07,220 --> 00:00:10,430 I want to do is see what type this hello world string is. 3 00:00:11,150 --> 00:00:20,300 So that I can do is add a parameter to this list and say type of and then after repeated Hello world. 4 00:00:21,800 --> 00:00:23,650 So let's take a look at that. 5 00:00:23,660 --> 00:00:26,270 I'm going to start up the live server. 6 00:00:34,480 --> 00:00:42,930 Pull over to the right of the console window and we see we have our strength whole world, and it tells 7 00:00:42,930 --> 00:00:44,770 us that it is a strength. 8 00:00:45,600 --> 00:00:47,060 So let's put in a few other types. 9 00:00:47,970 --> 00:00:57,060 So I'll say cancel that log 55 type of 55, 10 00:01:00,030 --> 00:01:01,260 cancel that log. 11 00:01:03,150 --> 00:01:03,690 True 12 00:01:06,330 --> 00:01:09,480 type of true. 13 00:01:13,020 --> 00:01:19,040 Let's run that again, we 55 is no and true is a boolean value. 14 00:01:20,020 --> 00:01:24,640 So we've done this with literals and literals, as I mentioned, cannot be reused. 15 00:01:24,640 --> 00:01:31,000 So we have a hollow road here and we have a hollow road there to literals to 55 to True's. 16 00:01:31,660 --> 00:01:34,720 So let's do the same thing except with with variables. 17 00:01:35,950 --> 00:01:36,550 So 18 00:01:39,550 --> 00:01:47,140 I'm going to say, let alone string equals overworld world. 19 00:01:50,410 --> 00:01:56,140 And I'm going to kind of repeat this council dialogue with the hello's string. 20 00:01:58,690 --> 00:02:06,430 Now, in this case, the string is only used once, it only exists once, but it's used twice. 21 00:02:09,100 --> 00:02:10,720 So it's the same hollow string. 22 00:02:11,750 --> 00:02:20,440 Let's add a couple others will say, but no value equals fifty six. 23 00:02:21,160 --> 00:02:24,910 Let true value equals false. 24 00:02:26,080 --> 00:02:35,960 And I'm going to do a little copying and pasting take or no value there. 25 00:02:36,940 --> 00:02:39,400 So there we'll take our true value. 26 00:02:41,110 --> 00:02:43,570 Placed it there and pasted there. 27 00:02:43,820 --> 00:02:44,840 Okay, let's run this. 28 00:02:48,190 --> 00:02:49,240 So here's our second set. 29 00:02:49,600 --> 00:02:50,350 Hello, Broadstone. 30 00:02:50,350 --> 00:02:54,150 Stranraer 56 is still a number and our forces are buia. 31 00:02:55,000 --> 00:02:56,470 So what about undefined. 32 00:02:56,860 --> 00:02:59,200 What comment? 33 00:02:59,310 --> 00:03:03,180 A few of these out to avoid confusion. 34 00:03:04,360 --> 00:03:13,620 So you get undefined by declaring a variable, let's say undefined value and you don't give it a value. 35 00:03:14,020 --> 00:03:17,510 So it is undefined, makes little sense. 36 00:03:18,400 --> 00:03:20,170 So if I consolo this out 37 00:03:22,900 --> 00:03:24,130 into a type of 38 00:03:27,830 --> 00:03:34,220 what we should get is that it's undefined, let's run it. 39 00:03:35,170 --> 00:03:43,840 So the value of it is undefined in its type is also undefined now because JavaScript has dynamic data 40 00:03:44,350 --> 00:03:45,380 dynamically defined. 41 00:03:45,580 --> 00:03:53,230 I can turn right around then say undefined value equals sixty six and log that out. 42 00:03:56,290 --> 00:03:59,170 I don't know why I'm typing when I could just copy. 43 00:04:10,210 --> 00:04:17,020 So now UNDEF value is sixty six in this type of number, and then we can turn around and change that 44 00:04:17,020 --> 00:04:28,470 yet again and say on that value equals hello again and load it out again. 45 00:04:31,000 --> 00:04:31,750 And 46 00:04:34,450 --> 00:04:35,560 now it's a straight. 47 00:04:38,090 --> 00:04:42,920 So it's really different with JavaScript compared to some other languages, once you define a variable 48 00:04:43,370 --> 00:04:44,480 in many languages. 49 00:04:46,550 --> 00:04:52,500 Next up, we have constants as well as what if we define a constant value? 50 00:04:56,570 --> 00:04:58,190 We have to give a value 51 00:05:02,840 --> 00:05:05,000 and then we log that out. 52 00:05:07,900 --> 00:05:12,320 The problem comes if you try to change it, it's not a problem because what you want is a constant value. 53 00:05:13,640 --> 00:05:20,240 So if I said my value goes one on one and try to log it out again to copy. 54 00:05:26,340 --> 00:05:34,680 So now we're going to get in there because it's an assignment to a constant variable, so you can't 55 00:05:34,680 --> 00:05:35,080 do that. 56 00:05:36,720 --> 00:05:37,190 All right. 57 00:05:38,940 --> 00:05:39,950 Come at these out. 58 00:05:41,250 --> 00:05:43,560 Let's take a look at the use strict. 59 00:05:43,800 --> 00:05:45,140 So this is the strict. 60 00:05:45,630 --> 00:05:52,160 So what you strict does not allow you to do is to say new value equals five. 61 00:05:53,040 --> 00:05:53,800 That's not allowed. 62 00:05:54,540 --> 00:05:55,910 Cancel that log. 63 00:05:56,970 --> 00:05:57,630 New value. 64 00:06:02,370 --> 00:06:04,020 So if I try to run this. 65 00:06:07,020 --> 00:06:12,460 I'm going to say new values, not to find that I go back and comment about the strict, it's going to 66 00:06:12,460 --> 00:06:12,980 allow it. 67 00:06:19,830 --> 00:06:28,650 So now it's loud, but we don't want that it can cause too many problems to have accidental and declare 68 00:06:28,650 --> 00:06:29,250 variables. 69 00:06:34,210 --> 00:06:39,670 All right, the next thing is, why don't we want to use the vaki word, if you look at much JavaScript, 70 00:06:39,670 --> 00:06:41,110 you'll see the VA keyword everywhere. 71 00:06:41,830 --> 00:06:45,740 So let's talk about why that's important and why that's a problem. 72 00:06:46,270 --> 00:06:55,390 So if I say VA X equals 30 and then I'm going to find some scope, a block of scope and we'll see more 73 00:06:55,390 --> 00:06:58,150 of this later when we get to conditionals and looping and things like that. 74 00:06:58,150 --> 00:06:59,680 But you can just say love. 75 00:06:59,680 --> 00:07:02,640 Curly Brace recalibrates and that's a new block of scope. 76 00:07:03,910 --> 00:07:11,400 And then I can say, let's say four X equals 20 and then let's talk this out. 77 00:07:14,920 --> 00:07:22,780 OK, and then let's copy this before we get to this block and after. 78 00:07:25,120 --> 00:07:29,350 So what's going to happen is that the VA is global. 79 00:07:29,830 --> 00:07:35,710 So I'm going to close the first VA X, it can be 30, but this X is going to be the same X. 80 00:07:36,850 --> 00:07:38,890 And what we want is for it to be a different X. 81 00:07:38,890 --> 00:07:41,950 So when we change the 20 is still 20 at the end. 82 00:07:42,970 --> 00:07:49,030 So we want when we declare variables inside of a curly brace, we want them to be local to that curly 83 00:07:49,030 --> 00:07:51,170 brace and be forgotten afterwards. 84 00:07:52,960 --> 00:07:54,590 So that's where it comes in. 85 00:07:54,610 --> 00:07:59,320 So if I say let X equals 30, let X equals 20. 86 00:08:02,160 --> 00:08:03,660 And we'll run it one more time 87 00:08:06,330 --> 00:08:07,930 than you can see, it started out as 30. 88 00:08:08,040 --> 00:08:09,420 It got changed to 20. 89 00:08:09,450 --> 00:08:10,200 It did not change. 90 00:08:10,200 --> 00:08:15,620 It declared a new variable X and gave it a value of 20 inside of this block. 91 00:08:16,650 --> 00:08:21,060 But then after the block, the other X was still 30. 92 00:08:23,580 --> 00:08:25,960 All right, so that's a introduction to data types. 93 00:08:26,430 --> 00:08:29,400 Next, we'll move on to operators and actually do something with this data.