| shift() The shift() method is used to shift the content of the given array up by one, returning the item that was in the first position regardless of its data type. No data type conversion is performed on the shifted array item. The content of position one is deleted from the array, but not before being returned from the operation, so the data is not lost. The item that was in position two is then shifted to position one, and the rest of the array items shift accordingly. syntax: array.shift() EXAMPLE var theArray = new Array("zebra", "armidillo", "horse"); document.write("The content order of the array is " + theArray[0] + ", " + theArray[1] + ", " + theArray[2] + " "); var shuffledArray = theArray.shift(); document.write("The new content order of the array is " + theArray[0] + ", " + theArray[1] + ", " + theArray[2] ); The example starts with the creation of a new array called theArray. It is loaded with three values, which are string values because they are encapsulated within quotes. The array is then written to the screen through the use of a document.write statement. The array is then shifted through the use of the shift() method. The second document.write statement then writes the newly shifted contents of the array to the screen. The output should look as follows: The content order of the array is zebra, armidillo, horse The new content order of the array is armidillo, horse, undefined |