e01.org

Method

A method is a function which is a property of an object. There are two kinds of methods: instance methods which are built-in tasks performed by an object instance, or static methods which are tasks that are called directly on an object constructor.

A **method** is a function which is a property of an object. There are two kinds of methods: _instance methods_ which are built-in tasks performed by an object instance, or _static 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 an object reference to a function.

When `F` is said to be a _method_ of `O`, it often means that `F` uses `O` as its [`this`](/docs/Web/JavaScript/Reference/Operators/this) binding. Function properties that do not have different behaviors based on their `this` value (or those that don't have a dynamic `this` binding at all — like [bound functions](/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) and [arrow functions](/docs/Web/JavaScript/Reference/Functions/Arrow_functions)) may not be universally recognized as methods.

## See also

- [Method (computer programming)](<https://en.wikipedia.org/wiki/Method_(computer_programming)>) in Wikipedia
- [Defining a method in JavaScript](/docs/Web/JavaScript/Reference/Functions/Method_definitions) (comparison of the traditional syntax and the new shorthand)
- [List of JavaScript built-in methods](/docs/Web/JavaScript/Reference)
- Related glossary terms:
- function
- object
- property
- static method

source: MDN Web Docs mirror · page

Cite this

"Method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Glossary/Method

JSON record · API collection · citation policy