JavaScript Class

Home Help Table of Contents Class Stuff

The Array object

An Array object is used to store a set of values in a single variable name.

An Array object is a variable that contains many values. Each value is an element of the array and has an associated index number. 

You can refer to a particular element in the array by using the name of the array and the index number. The index number starts at zero. 

You create an instance of the Array object with the "new" keyword.

The expected number of elements goes inside the parentheses, in this case 50.

You assign data to each of the elements in the array like this:

And the data can be retrieved from any element by using the index of the particular array element you want. Like this:

The Array object's methods are described below:

NN: Netscape, IE: Internet Explorer, ECMA: Web Standard

Methods Explanation NN IE ECMA
length Returns the number of elements in an array. This property is assigned a value when an array is created 3.0 4.0 1.0
join() Returns a string of all the elements of an array concatenated together 3.0 4.0 1.0
reverse() Returns the array reversed  3.0 4.0 1.0
sort() Returns a sorted array 3.0 4.0 1.0





Home Help Table of Contents Class Stuff