Flash / Flex / ActionScript/Array/forEach
Версия от 09:19, 26 мая 2010; (обсуждение)
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);
}
}
}