Prefixes elements to an array.
Parameters |
Description |
object |
The value of a new element. Each parameter represents
one new element. |
Return value |
Description |
Object[] |
The new array. |
Usage
This method modifies the base array.
Examples
This computed label appends two elements
to an array.
var a = new Array("one", "two", "three");
a.unshift("minus one", "zero");
var display = "";
for(var i=0; i<a.length; i++) {
display = display + a[i] + ", ";
}
display = display.left(display.length - 2);
display // minus one, zero, one, two, three