/ Published in: ActionScript 3
Consider the following piece of code which compares two arrays to find which elements exist in outerArray that do not exist in innerArray:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var outerArray:Array = ["coffee", "juice", "water", "beer"]; var innerArray:Array = ["liquor", "beer", "wine", "juice"]; for each (var foo:String in outerArray) { var found:Boolean = false; for each (var bar:String in innerArray) { if (foo == bar) { found = true; } } if (!found) { trace(foo); } }