
Skype: beeworkweb
Email:info@beework.net
Sales (free):
0800 882 4173
Support:
0870 978 0583
Mobile:
07866 627185
Registered Member
of the UK Web Design
Association
Generates the code to create a JavaScript array
1. arrayObjectName = new Array([arrayLength])To use Array objects:
2. arrayObjectName = new Array([el0, el1, ..., el3])
1. arrayObjectName.propertyName
2. arrayObjectName.methodName(parameters)
arrayLength is the initial length of the array. You can access this value using the length property.
elementn is a list of values for the array's elements. When this form is specified, the array is initalized with the specified values as its elements, and the array's length property is set to the number of arguments.
propertyName is one of the properties listed below.
methodName is one of the methods listed below.
You can specify an initial length when you create the array. The following code creates an array of five elements:
billingMethod = new Array(5)When you create an array, all of its elements are initially null.
musicTypes = new Array(25)An array's length increases if you assign a value to an element
musicTypes[0] = "R&B"
musicTypes[1] = "Blues"
musicTypes[2] = "Jazz"
colors = new Array()You can construct a dense array of two or more elements starting
colors[99] = "midnightblue"
myArray = new Array("Hello", myVar, 3.14159)In Navigator 2.0, you must index arrays by their ordinal number, document.forms[0]. In Navigator 3.0, you can index arrays by either their ordinal number or their name (if defined).myArray = new Array("Wind","Rain","Fire")You can then refer to the first element of the array asmyArray[0] or myArray["Wind"]. | Property | Description |
|---|---|
| length | Reflects the number of elements in an array |
| prototype | Lets you add a properties to an Array object. |