Object Method


A Javascript Object method is a property that contain a function defination.

Code Structure
var person = {
 firstName : "Bill",
 lastName : "Gates",
 age : 25,
 fullName : function() {
  return this.firstName + " " + this.lastName;
 }
}
alert(person.fullName() + " is " + person.age + " years old.");

Share this

Related Posts