Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript big time problem understanding object Reply To: big time problem understanding object

#153649
Alen
Participant

Objects have properties and methods.

Properties are just values. And methods are just functions that do something with the values.

As you can see in this example:

obj = {
  firstName: "Alen",
  lastName: "Mofo",
  fullName: function(){
    alert(this.firstName + " " + this.lastName);
  }
}
obj.fullName(); //Prints "Alen Mofo"

firstName and lastName is a property. fullName is a method.