1×
Become a member
to unlock all features
Autoplay

    this in Method Calls

    javascriptJavaScript

    When a function is called as a method of an object, that function's this argument is set to the object the method is called on. That object is called the receiver of the function call.

    Oftentimes, the receiver gets lost when we invoke a method as a function. This happens particularly often when passing a method as a callback to another function.

    In this lesson we'll see how the receiver mechanism works, what problems it creates, and how to work around these problems using wrapper functions or the bind method.