1 00:00:00,300 --> 00:00:07,470 Let's talk about another feature of its 20 20, and this one is called Global This. 2 00:00:08,520 --> 00:00:14,940 And the global this is a global variable that we now get, and because I have the latest version of 3 00:00:14,940 --> 00:00:20,160 Chrome, I can see that it works and this points to the window object. 4 00:00:20,430 --> 00:00:25,220 So global, this does it equal window. 5 00:00:26,910 --> 00:00:27,930 Yep, global. 6 00:00:27,940 --> 00:00:34,660 This is pretty much the window object that we get as part of our browser environment. 7 00:00:34,950 --> 00:00:42,720 Remember, the window object is what gives us things like set interval, set time out or any of the 8 00:00:42,720 --> 00:00:45,030 features that the browsers allow us to do. 9 00:00:45,510 --> 00:00:49,110 So why did we need a global this? 10 00:00:49,110 --> 00:00:52,800 That is pretty much what we already had with the window object. 11 00:00:53,700 --> 00:01:01,200 Well, the neat thing is that this global this works outside the browser as well. 12 00:01:01,620 --> 00:01:02,190 Let me show you. 13 00:01:04,480 --> 00:01:06,880 Now, if we had Noad. 14 00:01:07,860 --> 00:01:10,740 On our computer and we run. 15 00:01:11,910 --> 00:01:19,710 The command window to access the window object will get an air window is not defined because window 16 00:01:19,710 --> 00:01:25,670 is part of the browser, but inside of node no doesn't really work as a browser. 17 00:01:25,680 --> 00:01:27,750 It doesn't really know what window is. 18 00:01:28,260 --> 00:01:31,470 Instead, Node uses global write. 19 00:01:32,250 --> 00:01:36,570 The node version of window is the global object. 20 00:01:37,610 --> 00:01:45,170 Now, with E20, they wanted to unify different platforms outside of the browser so that there's a global 21 00:01:45,170 --> 00:01:47,480 variable that each one of them can access. 22 00:01:47,840 --> 00:01:49,640 So this. 23 00:01:50,710 --> 00:01:54,610 The global this now exists in note. 24 00:01:55,120 --> 00:01:59,830 Now, if you look over here, it's the exact same thing as the global object. 25 00:02:01,920 --> 00:02:11,310 That note has so it's still not really the window object, however, the global this object now exists 26 00:02:11,310 --> 00:02:20,880 as both part of the window and note so that you can have unified variables across different platforms, 27 00:02:21,360 --> 00:02:22,560 different systems. 28 00:02:23,840 --> 00:02:27,170 So although global, this has different. 29 00:02:28,060 --> 00:02:28,780 Properties. 30 00:02:30,140 --> 00:02:38,720 Inside of a browser than it does inside of Noad, we're able to have a unified code base if, let's 31 00:02:38,720 --> 00:02:42,710 say we want to run our app both in code as well as on the browser. 32 00:02:44,140 --> 00:02:47,410 Now, keep in mind that if I exit out of here. 33 00:02:50,550 --> 00:02:56,970 The reason I'm able to use the global this inside of note is that I have the latest version of note 34 00:02:57,120 --> 00:02:59,850 or at least a version that's higher than this. 35 00:03:00,060 --> 00:03:08,220 So you might not have global this work in Noad unless you have a later version, more modern version 36 00:03:08,220 --> 00:03:10,470 that has implemented this new feature. 37 00:03:11,220 --> 00:03:11,640 All right. 38 00:03:11,760 --> 00:03:12,480 Let's take a break. 39 00:03:12,510 --> 00:03:13,430 I'll see you in the next one.