When you expand the window object, and scroll down, within it, you eventually see the variable a: 'Hello World' and function b.
In JavaScript variables and functions not created inside other functions are attached to the global object.

So what that means is that, in the console; if you type 'a' you get "Hello World"
andm when you type window.a you also get Hello World.
The variable a and the function n we created are not inside a function, they are lexically sitting inside the global object.

When your code is executed, an execution context is created by the JavaScrip engine which also created a global object for example, the window object if you are in a browser. variable this, is created, and this will serve as the link to the outside environment.

The execution context is running your code!

Creation and hoisting comming up…

Back to Topics 👈🏻

Next Lesson: Comming upClick here👉🏽

Take one minute to let us know what you want us to cover here Here .

Connect on twitter Twitter.