Method
Amethod is afunction which is aproperty of anobject. There are two kinds of methods:instance methods which are built-in tasks performed by an object instance, orstatic methods which are tasks that are called directly on an object constructor.
Note:In JavaScript functions themselves are objects, so, in that context, a method is actually anobject reference to a function.
WhenF is said to be amethod ofO, it often means thatF usesO as itsthis binding. Function properties that do not have different behaviors based on theirthis value (or those that don't have a dynamicthis binding at all — likebound functions andarrow functions) may not be universally recognized as methods.
In this article
See also
- Method (computer programming) in Wikipedia
- Defining a method in JavaScript (comparison of the traditional syntax and the new shorthand)
- List of JavaScript built-in methods
- Related glossary terms: