Chapter 3 DynaScript Predefined Objects


Array object

Object

Enables the creation and manipulation of arrays.

Standard: ECMAScript

Syntax

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.

Description

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.

Example

 


Copyright © 1999 Sybase, Inc. All rights reserved.