Skip to content

Instantly share code, notes, and snippets.

@martindevans
Created October 4, 2012 22:30
Show Gist options
  • Save martindevans/3836881 to your computer and use it in GitHub Desktop.
Save martindevans/3836881 to your computer and use it in GitHub Desktop.
//Use an object as a set
var set = {}
//Create an object, give it some property
var item = {}
item.Foo = function() {};
set[item] = item;
for (key in set}
{
key.Foo(); //<-- nope
}
for (key in set)
{
set[key].Foo(); //<-- just fine
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment