Changes

Jump to: navigation, search

JavaScript Object Basics

8 bytes added, 13:43, 20 June 2007
Extending Objects
JavaScript object instances are extremely flexible in that they can easily be extended. To extend an object that you have already created use ''object prototypes''. The syntax for prototyping is as follows:
<tt>objectType.prototype.propertyName</tt>
Following this syntax we could add a ''year'' property to an our ''car'' class and initialize it to tyh eyear the year '2001' using the following:
<pre>
When we now create an instance of the object it will contain this new property which can be read and manipulated in the same way as all the other properties in this class.
This chapter provides provided the essential information to get started using objects in JavaScript. In the following chapters we will explore the built-in objects provided with JavaScript.

Navigation menu