shift Method
Removes the first element from an array and returns that element.
function shift() : Object
Remarks
The shift method removes the first element from an array and returns it.
Example
The following example illustrates the use of the shift method.
var ar = new Array(10, 11, 12);
var s = "";
while (ar.length > 0)
{
var i = ar.shift();
s += i.toString() + " ";
}
print(s);
// Output: 10 11 12
Requirements
Applies To:
See Also
Reference
Change History
Date |
History |
Reason |
---|---|---|
July 2009 |
Modified example. |
Content bug fix. |
March 2009 |
Added example. |
Information enhancement. |