Export (0) Print
Expand All
Expand Minimize

unshift Method (Windows Scripting - JScript)

Updated: March 2009

Inserts new elements at the start of an array.

                      arrayObj.unshift([item1[, item2 [, . . . [, itemN]]]])

arrayObj

Required. An Array object.

item1, item2,. . ., itemN

Optional. Elements to insert at the start of the Array.

The unshift method inserts elements into the start of an array, so they appear in the same order in which they appear in the argument list.

The following example illustrates the use of the unshift method.

var ar = new Array();
ar.unshift(10, 11);
ar.unshift(12, 13, 14);
document.write(ar.toString());

// Output: 12,13,14,10,11

Date

History

Reason

March 2009

Revised introduction and added example.

Content bug fix.

Community Additions

ADD
Show:
© 2014 Microsoft