Created
January 20, 2013 15:01
-
-
Save IQAndreas/4579236 to your computer and use it in GitHub Desktop.
Odd but valid syntax for retrieving keys or values from an object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Originally by @pleclech | |
// via http://pastebin.com/1MDyFVJA | |
var o:Object = { foo:"bar", hello:"world", one:"one", two:"two" }; | |
var values:Array = []; | |
for each (values[values.length] in o); | |
trace(values); // world,one,two,bar | |
var keys:Array = []; | |
for (keys[keys.length] in o); | |
trace(keys); // hello,one,two,foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment