Practice: Using function.call and function.apply

In JavaScript, call() and apply() methods allow you to assign a custom this value to your functions. Why might you want to do this? Well, using these methods can enable borrowing another object's methods. It is important to remember that the value of this is assigned when a method or function is called and not defined. We recommend you watch this video and try the examples in your editor. Note that this exercise does not count toward your grade; it is just for practice!


Source: CloseBrace, https://www.youtube.com/watch?v=BYubpRkWhtk
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License.

Last modified: Monday, August 21, 2023, 11:49 PM