Shortest JS program / This keyword / Window

https://www.youtube.com/watch?v=QCRpVw2KXf8&list=PLlasXeu85E9cQ32gLCvAvr9vNaUccPVNP&index=6&ab_channel=AkshaySaini

The shortest javascript program is an empty file. Yes, an empty file is the shortest javascript program. So whenever a program is executed a global object and a global execution context is created and along with it a this variable is created as well.

this === window 

// output: 
true

So this states that whenever a program is executed a global execution context is created along with a window that is also know as this. This points to the global object i.e the window in the case of web.

var a = 10;
function b() {
	var x = 10;
} 

Here in the global execution i.e the window if we console.log(window) we will see a = 10 and b() we wont see x = 10 as its in the local execution of the b().

// Here if we do
console.log(a)
console.log(window.a)
console.log(this.a)

These both things are same as a is in the global object only. And same way this is used to access the global execution and hence the third will give the same output as well