shift Method (Windows Scripting - JScript)
Removes the first element from an array and returns it.
Syntax
arrayObj.shift( )
Remarks
The required arrayObj reference is an Array object.
The shift method removes the first element from an array and returns it.
The following example illustrates the use of the shift method.
var ar = new Array(10, 11, 12);
while (ar.length > 0)
{
var i = ar.shift();
document.write (i.toString() + " ");
}
// Output: 10 11 12
Requirements
Applies To: Array Object (Windows Scripting - JScript)
Change History
Date |
History |
Reason |
---|---|---|
March 2009 |
Added example. |
Information enhancement. |