Use concat to combine two arrays : concat « Array « Flash / Flex / ActionScript






Use concat to combine two arrays

 


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

        var guests:Array = ["P", "D"];
        var registeredPlayers:Array = ["G", "D", "T"];
        var allUsers:Array = registeredPlayers.concat(guests);
        
        trace(allUsers); // G,D,T,P,D

    }
  }
}

        








Related examples in the same category

1.The concat( ) method combines two or more arrays into a single, new array: origArray.concat(elementList)
2.concat( ) does not flatten nested arrays
3.Creating New Arrays from Existing Arrays