• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Combining Statements into Fu... > Using Function.apply() and Function....

Using Function.apply() and Function.call()

The apply() and call() methods, which are defined for all functions, allow you to call a function or method as if it were a method of any designated object. You specify the object as the first argument of the apply() or call() method. Inside the called function, the this keyword will refer to the designated object.


Without the apply() and call() methods, when you call a function or method, you’re stuck with a default value for this. For example, if you call a method, this refers to the object that the method belongs to. If you call a function on a timeline, this refers to the timeline.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint