Array Power, Part I - DHTML Lab | 5 | WebReference

Array Power, Part I - DHTML Lab | 5


Array Power, Part I
unshift() demo

In the following example, we start with an empty array.

The SELECT menu has several values which you can add as elements to the array. They are a mix of string, Boolean, number and array values. Click a value to add it to the array.

The statement generated to add the value is displayed in the Statement field.

The current contents of the array are displayed in the New myArray field. The statement's return value appears in the arLength field.

Original myArray: [ ]
New myArray:
Click one of these options to add to array:


Whatever is unshifted can, of course, be shifted, so let's look at the shift() method.

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: April 26, 2000
Revised: April 26, 2000