next up previous contents
Next: Date Object Up: Methods Previous: splice   Contents


unshift

Description

Adds one or more elements to the beginning of an array and returns the array's new length.


Syntax

array1.unshift(value_0, value_1, ..., value_N)


Parameters

value_0, value_1, ..., value_N
One or more numbers, elements, or variables to be inserted at the beginning of the array.


Returns

The new length of the array.


Example

a = [3, 4, 5, 6];
trace(a.unshift(2, 1, 0));
//output: 7
trace(a);
//output: 0,1,2,3,4,5,6




Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.