How do you get access to the window object and this variable ?
The base execution context is one of those many execution contexts known as global execution context.
Global execution context available every where and all the places. And global execution context creates two things for you (you dont have to create) global object and 'this' variable.
Lets test it !
Open any folder and create a file index.html and another file test.js' both should be empty. Write down the following code inside the html file.
<html> <head> </head> <body> <script src="test.js"></script> </body> </html>
Now open index.html in google chrome and go to console(f12->developer tool->console) The document should open empty as there are nothing. Lets take a peek at the execution context by typing 'this' and hit enter. the 'this' object which is part of global execution context will be shown; in this case it is windows object.
For now just consider code or variable that aren't inside a function are global. Don't think too much as of now ! We will cover more on this.
Lets go to our test.js file and write the bellow code and save the file.
var a = 'hello world!';
Now reload index.html file in chrome. Go to js console (f12->developer tool->console).
We can type window.a and window.abc to see them attached with window object.
So variable and function when lexically not sitting inside a function they are right there sitting inside global object.