METHOD:  Array::shiftNetscape Only Feature


Array.shift()
 
The shift method is used to remove and return the first element of an array. This affects the length of the array. The following example creates an array called 'cars' with the listed elements, and the shift method then removes and returns the first element "Mercedes" leaving just the two elements "Ford" and "Chrysler" in the array:
 
Code:
cars = ["Mercedes", "Ford", "Chrysler"]
document.write(cars.shift())

 
Output:
Mercedes


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information