Array.unshift()
Top  Previous  Next


SWiSH Player Support
SWF5 or later - Supported Internally

Syntax
arrayName.unshift(value1, value2, ...);

Arguments
value(s): One or more new elements to be added at the beginning of the array.

Returns
The updated length of the base array.

Description
Method; places the new elements specified by the value argument at the beginning of the array and returns the updated length of the array.

Samples
onLoad() {
  
  days = new Array("Wednesday","Thursday","Friday","Saturday");
  
  trace(days.length);
    // displays '4' in the debug window
    week = days.unshift("Sunday","Monday","Tuesday");
  
  trace(week); 
    // displays '7' in the debug window
}