Encapsulation − the capability to store related information, whether data or methods, together in an object.
1. Aggregation − the capability to store one object inside another object.
2. Inheritance − the capability of a class to rely upon another class (or number of classes) for some of its properties and methods.
3. Polymorphism − the capability to write one function or method that works in a variety of different ways.
Objects are composed of attributes. If an attribute contains a function, it is considered to be a method of the object, otherwise the attribute is considered a property.
Object properties can be any of the three primitive data types, or any of the abstract data types, such as another object. Object properties are usually variables that are used internally in the object's methods, but can also be globally visible variables that are used throughout the page.
The syntax for adding a property to an object is −
objectName.objectProperty = propertyValue;