myArray.unshift( [ newItem1 ], [ newItem2 ], [ ... ] ) in ECMAScript 262

Insert items to the front of an array, and return the new length.

Arguments

nametypedescription
newItem1 Object [optional] The first item to insert.
newItem2 Object [optional] The second item to insert.
... Object [optional] etc.
Return Type
Number

Description

The original array is modified. If any argument is itself an array, it is added as a single element. (Use Array.concat() to stick two arrays together.) The items added to the array are in the same order as they appear in the arguments list. For example:

var peopleInLine = [ 'Bob' , 'Joe' , 'Susan' , 'Lisa' , 'Dan' ];
var lineCount = peopleInLine.unshift('VIP1','VIP2','VIP3','VIP4');
// ** lineCount is 9
// ** peopleInLine is ['VIP1','VIP2','VIP3','VIP4','Bob','Joe','Susan','Lisa','Dan']