Chapter 3 DynaScript Predefined Objects
Enables the creation and manipulation of arrays.
Standard: ECMAScript
To use an Array property:
Array.propertyName
To use an Array method:
Array.MethodName( parameter )
The Array object has both a built-in object as well as constructors that allow users to create instances of an Array object. When referring to Array in the syntax of this chapter, we are referring to an instance of an array, not the built-in Array object.
Calling an array as a function or as a constructor has equivalent results - both create and initialize a new Array object.
To create an Array with a constructor:
myArray = new Array( [item0 [, item1 [, item2...]]] );
myArray = new Array( length )
It is generally more efficient to create an array with the number of elements you expect to use (or approximately), rather than growing the Array dynamically.
<!--SCRIPT
myArray = new Array(4)
myArray[0]= "number one";
myArray[1]= "number two";
myArray[2]= "number three";
myArray[3]= "number four";
document.WriteLn(myArray);
-->
Copyright © 1999 Sybase, Inc. All rights reserved. |