shift( ) removes an element from the beginning of an array: theArray.shift( ) : shift « Array « Flash / Flex / ActionScript






shift( ) removes an element from the beginning of an array: theArray.shift( )

 

shift( ) returns the value of the element it removes. 

The remaining elements all move up in the pecking order toward the beginning of the array.


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var sports:Array = ["q", "s", "i"];
        trace(sports.shift(  ));  
        trace(sports.shift(  ));  


    }
  }
}

        








Related examples in the same category

1.Removing the First Element of an Array: shift() method removes the element from the beginning of the array.
2.The shift( ) method removes the first element of the array and returns its value.