Bisexual Pride

Once you start working with objects in JavaScript, you might wonder: what’s the difference between properties and methods?

Let’s look at a simple object literal that describes my dog:

const dog = {
name: 'Yoko',
breed: 'Labrador',
bark() {
return 'Woof!';
}
};

Technically, the name, breed, and bark members are all properties.

But the usual distinction is that the name and breed members are properties, while the bark member is a method.

The MDN Web Docs explain that this is just a convention:

It's typical when speaking of an object's properties to make a distinction between properties and methods. However, the property/method distinction is little more than a convention. A method is simply a property that can be called (for example, if it has a reference to a Function instance as its value).

While this may be little more than a convention, I think it’s important to stick with it. The distinction is well established and people will know what you’re talking about. In a discipline as complex as software engineering, it pays to be explicit.