Adds an element to a one-dimensional array.

Syntax

<oRef>.add(<exp>)

<oRef>

A reference to the one-dimensional array to which you want to add the element.

<exp>

An expression of any type you want to assign to the new element.

Property of

Array

Description

Use add( ) to dynamically build a one-dimensional array.

add( ) adds a new element to a one-dimensional array and assigns <exp> to the new element.

You can create an empty one-dimensional array in a statement like:

a = new Array( ) // No parameters to Array class creates empty 1-D array

and add elements as needed.