And with context, which is the object to which a method belongs, from time to time, you might ask yourself, what is this or what context is this method executed it? So when you think of scope, think of variables. And when you think of context, think methods. Let's look at an example. Now just let's start out with kind of a pseudocode approach. I've got these three things on the screen, I've got Sam 123, and function.
I can't get my hands on them, they're just there, I needed a way to refer to them. So we need to, we need to refer to these values in a way by giving them some kind of name. So let's call Sam name, let's call 123. Count, and let's call the function greet. So by doing that, I now have a way to refer to each one of these things. So when I leverage scope, I can create variables for each one of these things.
I can say var name equals Sam, var count equals 123. And var greed equals function. And if I was going to leverage content Next, I could create an object, let's just say the object called OBJ. And I could give that object properties because objects have properties. And I could give it a name property that Sam and I could give it a count property that's 123. And I could give it a great property, that's dysfunction.
And four greet equals function. And inside of the greet function, I'll enter the name value. So I'm creating handles for these values by creating variables. Now, if I wanted to leverage context, I could create an OBJ variable, it's an object and then I give that object property so OBJ name is Sam and OBJ dot count. Because 123 and OBJ dot greet is a function. And I learned this name, which would alert Sam.
Now we're going to talk a little more in depth about what the this keyword means. But just right now just keep in mind that when it comes to context, the this keyword is really important, and that this keyword refers to the object which a method belongs. Now if I was going to kind of mix it up and use scope and context, I could say OBJ isn't a variable, and name is a variable, but OBJ count is a property and then OBJ dot greet is also a property. It's also a method when objects property is a method or a function. And then it's called a method. So objects have properties.
But when a property is a function, it's a method. In this case, it alerts the name variable. So kind of three ways to really two ways to look at it. You can leverage scope and create variables, you can leverage context and create Object Properties. Or you can certainly mix and match So, once again scope is the visibility of variables. And when you think of scope, think variables and context is the object to which a method belongs.
And when you think of context, think methods