AS3 - for (… in …) vs for each (… in …)
问题 The following code does the exact same thing. Is there a difference between for each and for (... in ...) ? var bar:Array = new Array(1,2,3); for (var foo in bar){ trace(foo); } for each (var foo2 in bar){ trace(foo2); } 回答1: No, they do not do the exact same thing. The output of your for..in loop is 0 1 2 While the output of your for each..in loop is 1 2 3 A for..in loop iterates through the keys/indices of an array or property names of an object. A for each..in loop iterates through the