In JavaScript, object definition is handled as an extension of the function definition syntax. Specialized functions called constructor functions are used as templates upon which an object is based. Statements within the constructor function perform initialization tasks such as defining and assigning values to the properties of the object. As with standard object-oriented programming, JavaScript allows an object to present methods and properties. Methods provide processing routines that are said to operate on the object.
Properties are variables that contain values that help define the nature of the object.
Methods are defined for JavaScript object by trading a normal function and then declaring it as a method within the constructor function of the object. The declaration within the constructor function is accomplished using the this keyword. Properties are defined for JavaScript objects by declaring within the constructor function using the this keyword. Initial values may be assigned to the properties within the constructor function or values may be assigned later. Within the body of a method, statements may use any property of the object to which the method belongs by using the this keyword to reference it.