I’m a fan of one-liners, and here’s an AWESOME one-line that saves a LOT of code, use this in a for each() for maximum fun.
someArray().filter(function(o:*, index:int, arr:Array):Boolean{return o.selected})
This makes looping through arrays and checking values quick and painless. You can also add in a .every() function on the end if you’re doing something simple, like tracing or logging (just remember to return false; in the every function).
1 comment so far ↓
thanks for the tip.