Array.unshift( ) Method | Flash 5 |
add one or more elements to the beginning of an array |
A list of one or more element values to be added to the beginning of array.
The new length of array.
The unshift( ) method adds a series of elements to the beginning of an array. Elements are added in the order specified. To add elements at the end of an array, use push( ).
myList = new Array (5, 6); myList.unshift(4); // myList becomes [4, 5, 6] myList.unshift(7, 1); // myList becomes [7, 1, 4, 5, 6]
Array.push( ), Array.shift( ); "Adding Elements to an Array," in Chapter 11