1 00:00:00,780 --> 00:00:08,910 We'll come back to lesson six, null and undefined, this means no is it intentionally points to a non-existent 2 00:00:08,910 --> 00:00:10,610 or invalid object address. 3 00:00:11,160 --> 00:00:16,560 Think of a room that explicitly has been marked as empty. 4 00:00:17,970 --> 00:00:23,700 And then undefined is a little bit different, that's assigned to a variable that was just created, 5 00:00:23,700 --> 00:00:27,960 just declared, but no value has been assigned to it yet. 6 00:00:28,470 --> 00:00:30,170 So it's not explicitly empty. 7 00:00:30,180 --> 00:00:32,410 It's as if there is no room there. 8 00:00:32,850 --> 00:00:39,030 So it's kind of the difference between having a room that's, you know, is empty and having a room 9 00:00:39,030 --> 00:00:41,190 that you haven't visited yet. 10 00:00:41,190 --> 00:00:42,020 So you don't know what's in it. 11 00:00:42,950 --> 00:00:47,030 So we're going to look at these in code and learn a little bit more about them. 12 00:00:49,040 --> 00:00:54,410 OK, so here we are and there's not a ton to get into right here, but basically we can. 13 00:00:55,840 --> 00:01:03,280 Just do some sample variables and let's just say we declare this variable, variable one. 14 00:01:04,030 --> 00:01:06,280 Now, if we just go ahead and cast a long time, 15 00:01:09,580 --> 00:01:12,550 then we're not going to get a specific value. 16 00:01:13,750 --> 00:01:17,850 What we are going to get, though, is this value undefined? 17 00:01:18,850 --> 00:01:21,750 It's not necessarily a problem that a variable is undefined. 18 00:01:21,760 --> 00:01:25,990 It's OK if it doesn't have a value, certain variable types. 19 00:01:26,020 --> 00:01:27,940 It's not OK if they don't have a value. 20 00:01:28,000 --> 00:01:34,390 So const, for example, it's going to shout at you, hey, since you're not going to be able to edit 21 00:01:34,390 --> 00:01:39,760 this value later, you need to initialize some value in this declaration so you're not going to find 22 00:01:39,760 --> 00:01:41,380 const variables that are undefined. 23 00:01:42,100 --> 00:01:46,750 But we could set this to know if we wanted to. 24 00:01:47,350 --> 00:01:50,250 We totally could and give it in no value. 25 00:01:50,950 --> 00:01:52,810 So that means it's explicitly empty. 26 00:01:53,150 --> 00:01:57,850 What's fantastic about this is now we have a variable that is always going to be No. 27 00:01:58,730 --> 00:01:59,480 Very interesting. 28 00:01:59,810 --> 00:02:03,410 So since we can't reassign it to any other thing, right. 29 00:02:03,680 --> 00:02:12,500 Remember how we can't give this a separate value later because it will catch us and be like, hey, 30 00:02:12,890 --> 00:02:16,040 you cannot assigned to a constant variable, stop that. 31 00:02:16,640 --> 00:02:18,320 So we're better off just like that. 32 00:02:19,790 --> 00:02:21,830 And we have null and undefined. 33 00:02:22,870 --> 00:02:29,860 So in computer science and no value is it represents a reference that points intentionally to a non-existent 34 00:02:29,860 --> 00:02:33,820 or invalid address, so that varies among languages. 35 00:02:33,820 --> 00:02:40,900 But basically here we're just saying this has no value, which if you interpret this as a true or false 36 00:02:40,900 --> 00:02:42,340 value, it is false. 37 00:02:42,940 --> 00:02:50,530 OK, it's fairly primitive, but as far as it being a primitive data type like numbers and strings, 38 00:02:50,650 --> 00:02:57,310 but there are other things that you can do with this involving objects, and we'll learn about those 39 00:02:57,310 --> 00:02:58,090 later as well. 40 00:02:58,270 --> 00:03:03,160 Now, undefined, if you recall from this other example, you can't do it. 41 00:03:03,410 --> 00:03:04,230 So let's do let. 42 00:03:06,010 --> 00:03:14,040 So if we just set this up and just give it no value, we just declared it, but we did not sign anything. 43 00:03:14,590 --> 00:03:15,880 It is undefined. 44 00:03:16,330 --> 00:03:21,100 OK, so this comes in handy when we need to calculate the variable value later or if the value is dependent 45 00:03:21,100 --> 00:03:26,180 on the user's input so we can just create a variable now and use it later. 46 00:03:26,260 --> 00:03:28,060 So we'll see later on. 47 00:03:28,060 --> 00:03:34,800 We want to reset the value to some user information. 48 00:03:35,230 --> 00:03:39,640 So we'll just we'll just prompt for for some value. 49 00:03:40,480 --> 00:03:43,030 And then we see a. 50 00:03:45,110 --> 00:03:48,770 And then we could on that as well at the end. 51 00:03:51,530 --> 00:04:00,320 So let's say, hey, and there you go, the prompt spat out, the answer to that prompt prompt is a 52 00:04:00,320 --> 00:04:01,160 really cool thing. 53 00:04:01,160 --> 00:04:06,260 You can as you can see, you can use it to just make a little quiz question anywhere you want. 54 00:04:06,650 --> 00:04:10,260 Prompts are used a lot for authentication on websites. 55 00:04:10,270 --> 00:04:12,860 Hey, you need to log in, put your password in things like that. 56 00:04:13,400 --> 00:04:17,480 Just built right into JavaScript is very basic, basic function, as you can see. 57 00:04:17,840 --> 00:04:21,050 OK, that is it for null and undefined. 58 00:04:22,060 --> 00:04:23,350 And we will come back to you to.