Skip to content

Instantly share code, notes, and snippets.

@jtenner
Last active December 27, 2015 12:09
Show Gist options
  • Save jtenner/7323918 to your computer and use it in GitHub Desktop.
Save jtenner/7323918 to your computer and use it in GitHub Desktop.
var closuredObjects = [/*put a bunch of objects that need a closure here*/];
closuredObjects.forEach(function(item){
var invisibleProperties = {};
item.get = function(key){
return invisibleProperties[key];
};
item.set = function(key, value){
invisibleProperties[key] = value;
return value;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment