Check out a free preview of the full Introduction to JavaScript course:
The "Global Objects" Lesson is part of the full, Introduction to JavaScript course featured in this preview video. Here's what you'd learn in this lesson's course:

Brian demonstrates usage of global objects, specifically the window object in the browser.

Get Unlimited Access Now

Transcript from the "Global Objects" Lesson

>> Brian Holt: So here, I'm talking about what this is can be in other settings, right? So that's a console.log like this is window and that's true, right? So in this particular case, whenever I'd call this, it is referring to the entire window. And you can see here that this .scroll which is how far down on the page scroll is exactly the same.

In fact, if I change it, it'll change based on where I am which is kind of cool, right? But if I land live in the same place, it won't change, right? I'm not scrolling anywhere. We can see I can access that both on this .scrollY and we know .scrollY, because they are the same thing.

Yep, so here, I kind of restate that. If you're inside an object, a good rule of thumb that this will be the object. If you are not inside of an object of some sort, this is gonna be window or whatever the global object is which for browsers is window.

>> Speaker 2: [COUGH] The attributes in the objects, do they have names? How we should, call them?
>> Brian Holt: Yeah, like the keys or properties?
>> Speaker 2: Keys, yeah, or just key in.
>> Brian Holt: This is the key. This is the value and the whole thing would be called up like a property.

>> Speaker 2: A property, okay.
>> Brian Holt: Yep.
>> Brian Holt: So in here, I have links to Kyle Simpson's which I link here, JavaScript foundations. He actually has a whole section here on learn this. So it is probably a pretty good place to go down, if you want understand it better. If you are doing in job interviews for JavaScript jobs, they love to ask questions about this, because it is so have to.

I have problems with JavaScript interviews.
>> Speaker 2: [LAUGH]
>> Brian Holt: It feels more like jeopardy than if feels like an interview. So that's actually, probably a pretty good one to figure out context and what this is and those sorts of things.