Let's talk about another feature of its 20 20, and this one is called Global This.
And the global this is a global variable that we now get, and because I have the latest version of
Chrome, I can see that it works and this points to the window object.
So global, this does it equal window.
Yep, global.
This is pretty much the window object that we get as part of our browser environment.
Remember, the window object is what gives us things like set interval, set time out or any of the
features that the browsers allow us to do.
So why did we need a global this?
That is pretty much what we already had with the window object.
Well, the neat thing is that this global this works outside the browser as well.
Let me show you.
Now, if we had Noad.
On our computer and we run.
The command window to access the window object will get an air window is not defined because window
is part of the browser, but inside of node no doesn't really work as a browser.
It doesn't really know what window is.
Instead, Node uses global write.
The node version of window is the global object.
Now, with E20, they wanted to unify different platforms outside of the browser so that there's a global
variable that each one of them can access.
So this.
The global this now exists in note.
Now, if you look over here, it's the exact same thing as the global object.
That note has so it's still not really the window object, however, the global this object now exists
as both part of the window and note so that you can have unified variables across different platforms,
different systems.
So although global, this has different.
Properties.
Inside of a browser than it does inside of Noad, we're able to have a unified code base if, let's
say we want to run our app both in code as well as on the browser.
Now, keep in mind that if I exit out of here.
The reason I'm able to use the global this inside of note is that I have the latest version of note
or at least a version that's higher than this.
So you might not have global this work in Noad unless you have a later version, more modern version
that has implemented this new feature.
All right.
Let's take a break.
I'll see you in the next one.