Appending Values to the End of an Array: The push() accepts one or more parameters and appends those values to the end of the array. : Push « Array « Flash / Flex / ActionScript






Appending Values to the End of an Array: The push() accepts one or more parameters and appends those values to the end of the array.

 

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

        var aEmployees:Array = ["A", "P", "C", "H"];
        aEmployees.push("Ruth");
        
        trace(aEmployees.toString());


    }
  }
}

        








Related examples in the same category

1.You are not limited to adding a single element at a time with push method
2.push() method always appends new elements, even if all the existing elements have undefined values.
3.Items added to the list can be any expression.