Changes

Jump to: navigation, search

JavaScript Object Basics

78 bytes added, 18:27, 26 April 2007
Creating and using Object Instances
In the above outline ''object'' refers to the name of the object - this can be any valid (and hopefully descriptive) name you choose to use. The ''parameters'' define the values that you will pass into the object when you instantiate it later. Each of these parameters is subsequently assigned to the corresponding internal ''properties'' of the object (the ''this'' keyword references the current object). The functions represent the methods of the object and are declared the same way as any other functions and reside outside the object definition.
== Creating and using Using Object Instances ==
In the previous section we learned how to create an object definition. It is important to note that, at this point, we have only described what the object will do(we have bascically created blueprint of the object), we have not actually created an object we can work with (this is known as an ''object instance''). Object instances are created using the ''new'' keywrod and are assigned to an object variable that will be used to reference the object. For example, in the following example we will create anew instance of the car object with the name myCar:
<pre>
This chapter provides the essential information to get started using objects in JavaScript. In the following chapters we will explore the built-in objects provided with JavaScript.
 
== Extending Objects ==

Navigation menu