Properties and methods in JavaScript

When you begin working with objects in JavaScript, it’s easy to get confused over properties and methods.

Let’s look at a simple object literal:

var dog = {
  name: "Yoko",
  breed: "Labrador",
  bark: function () {
    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 understood.

If you have questions, feedback, or any other suggestions, please do email me. I'd love to hear from you!