Skip to content

Instantly share code, notes, and snippets.

@IQAndreas
Created January 20, 2013 15:01
Show Gist options
  • Save IQAndreas/4579236 to your computer and use it in GitHub Desktop.
Save IQAndreas/4579236 to your computer and use it in GitHub Desktop.
Odd but valid syntax for retrieving keys or values from an object
// 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