Adds one or more elements to the beginning of an array and returns the new length of the array.
Array
arrayName.unshift(elt1,..., eltN)
elt1...eltN
The elements to add to the front of the array.
The following code displays the myFish array before and after adding elements to it.
myFish = ["angel", "clown"]; Console.Write("myFish before: " + myFish); unshifted = myFish.unshift("drum", "lion"); Console.Write("myFish after: " + myFish); Console.Write("New length: " + unshifted);
This example displays the following:
Array: pop, Array: push, Array: shift