- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Object Methods
JavaScript Objects
JavaScript Object Methods
A JavaScript object method is a function stored as a property of an object.
A method is just a function that belongs to an object.
Inside it, this refers to the object it was called on.
Example
Example
javascript
const person = {
name: "Ada",
greet: function () {
return "Hello " + this.name;
}
};
console.log(person.greet());