Hello, in this jQuery video, we are going to look at the proxy method, the proxy method is used to return a function that will always run in the provided scope, you know that it sets the meaning of this inside the past function to the second argument. So what you what that function will do is when you call that if you provide an object to it, and you use the keyword this that will actually refer to the object and not you know this as in, you know the class for example, so, let me implement this to show you that if we create a function, so I'm gonna call it funk equal function. And now, this is single standard console dot log. That's gonna log that's all it's going to do simple stuff. Now we're going to create an object on the call list. object if I can spell that correctly.
So this is nothing new in terms of creating objects and functions on the hub with variable in here called The no my favorite food, you can eat some literally just ordered pizza. So once I've done this video plus one more, then I'm going to be adding some food. Okay, so what we're going to do now is we are going to do Vol. Two actually, you know, essentially create the proxy function, we need a variable. So proxy function equals dollar dot proxy. And first of all you pass in the function so then you passing the object and now you pass it in.
Will you call proxy function, you actually call it and let's actually call that's F and that's what we need. Yeah, if we run it, as he said, food, pizza. So if for example, we had a several objects, and this function was doing a lot of, you know, tasks, maybe it's looping through it, printing the item to a table, putting in a database, that sort of stuff. And if I put, you know, console dot log, and if I do something like hello world, for example. And I run it, I think the printer I played also has access to this object so you can manipulate it, that's the way you know, you sort of, you know, change the scope of the disk keyword. This is now referring to the object.
This function is essentially called on top of the objects. So the great thing about that is you might have an object that in or you might have several different types of objects, but you might have a function that needs to know apply to all of them in some capacity. This is a great way the proxy function is fantastic, simple stuff. If you have any questions though, feel free to pop me a message and as usual, I look forward to seeing you in the next Video