# Object Methods & this — JavaScript

Source: https://www.geekswithgeeks.com/en/javascript/js-object-this

> Functions as properties, and what `this` points to.

## Methods

A function stored as a property is a **method** — call it with `object.method()`.

```js
const dog = {
  name: "Rex",
  bark() {
    return `${this.name} says Woof!`;
  },
};
console.log(dog.bark());  // Rex says Woof!
```

## What this refers to

Inside a regular method, `this` refers to the object the method was called **on** — not where it was defined.

## Losing this

Passing `dog.bark` as a standalone callback loses its `this` binding — use `.bind()` or an arrow wrapper to fix it.
