Last active
December 27, 2015 12:09
-
-
Save jtenner/7323918 to your computer and use it in GitHub Desktop.
This file contains 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
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