Method Function
Starting with ECMAScript 2015, you are able to define own methods in a shorter syntax, similar to the getters and setters. See method definitions for more information.
1
2
3
4
var obj = {
  foo() {},
  bar() {}
};
Starting with ECMAScript 2015, a shorter syntax for method definitions on objects initializers is introduced. It is a shorthand for a function assigned to the method’s name.
A method is a function which is a property of an object. There are two kind 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.
 This post is licensed under  CC BY 4.0  by the author.