Since students may not have a background in object oriented programming, it may be useful to cover the basic concepts involved in an abstract way before discussing the JavaScript implementation of those concepts. 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.