A method can be considered to be an object’s behavior. Methods are the actions that can be performed on objects. Methods are stored in properties as function definitions. The last item on this list is a object method:
Property | Property Value |
---|---|
firstName | John |
lastName | Doe |
age | 50 |
eyeColor | blue |
fullName | function() {return this.firstName + " " + this.lastName;} |
JavaScript objects are containers for named values (called properties) and methods.