Using the forEach() Method to loop through items in an array : ForEach : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » ForEach »

 

Using the forEach() Method to loop through items in an array


 

function functionName(element:*, index:int, array:Array):void
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var subjects:Array = ["Art""Science""Math""History"];
        subjects.forEach(traceArray);

    }


    function traceArray(element:*, index:int, a:Array):void {
        trace("["+ index + "] = "+ element);
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» ForEach