New features in AS3 Array class

Some methods newly added to Array calss in AS3 will save time to code “for” loops.
Adobe should have introduced them earlier…
AS3의 Array 클래스에 새로운 메소드들이 등장하면서 for 루프 돌리는 일이 많이 줄어들 것 같네요 ^^
더 빨리 나왔어야 했는데…

every(callback:Function, thisObject:* = null):Boolean
Executes a test function on each item in the array until an item is reached that returns false for the specified function.

some(callback:Function, thisObject:* = null):Boolean
Executes a test function on each item in the array until an item is reached that returns true.

filter(callback:Function, thisObject:* = null):Array
Executes a test function on each item in the array and constructs a new array for all items that return true for the specified function.

forEach(callback:Function, thisObject:* = null):void
Executes a function on each item in the array.

indexOf(searchElement:*, fromIndex:int = 0):int
Searches for an item in an array by using strict equality (===) and returns the index position of the item.

lastIndexOf(searchElement:*, fromIndex:int = 0×7fffffff):int
Searches for an item in an array, working backward from the last item, and returns the index position of the matching item using strict equality (===).

quote from ActionScript 3.0 Language and Components Reference

Leave a Reply