1. Technology

JavaScript Objects

What is an Object?

By

JavaScript has two different types of objects that it can use. There are those objects that are predefined by the language itself which we can either use directly or use as a prototype to create our own objects of that particular type and there are those objects where we define the object prototype ourselves in order to create objects that are specific to our particular script. In this chapter we will look at some of the objects that JavaScript provides to us to use directly without having to define the methods and properties for ourselves. We can also extend the functionality of existing objects by adding our own methods and properties.

The first of the objects that JavaScript provides for us to use in our code is the Object. This particular object provides the prototype definition from which all of the other object types that JavaScript supports are derived and it provides the very basic methods and properties that will exist for all of the objects used in your script. Apart from being the base from which all of the other built-in objects are derived you can use the Object object as a base to create your own objects.

The most commonly used object that you will find referenced in JavaScript is the Array. An Array basically provides you with a way of grouping a number of similar variables together making it easier to process all of them together rather than having to process each one individually.

Other types of object that you will commonly use in your JavaScript code include Date (for processing dates and times), Math (which provides extensive mathematical functionality far beyond the simple arithmetic possible using the basic mathematical operators), and String (which similarly provides extensive string manipulation capabilities).

Related Video
Upload Videos to Google Video
  1. About.com
  2. Technology
  3. JavaScript
  4. Reference
  5. JavaScript Objects

©2014 About.com. All rights reserved.