Apply, Call, Bind, & arguments
We are going to showcase a way to explicitly set the value of
this in a function. We can use the
Occasionally, it’s more useful and makes more sense for the
this inside functions by using these three methods.
Occasionally, we want to use a method of one object on another. Remember that in OOP, methods are meant to act on the object that they are a property of. It’s often useful to take these methods and apply them (no pun intended) to different objects to perform the same action.
This prevents code duplication and makes it clear that we are using a method on a different object than it was intended.