Skip to content

Instantly share code, notes, and snippets.

@zhannes
Created February 1, 2013 14:44
Show Gist options
  • Save zhannes/4691697 to your computer and use it in GitHub Desktop.
Save zhannes/4691697 to your computer and use it in GitHub Desktop.
var mod = (function(){
var foo; // set from outside
function setItem(val){
val && (foo = val);
}
return { setItem: setItem };
})();
mod.setItem('awesome val');
// no access to mod -> foo, not from out here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment