Skip to content

Instantly share code, notes, and snippets.

@sashasklar
Created March 22, 2011 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sashasklar/882196 to your computer and use it in GitHub Desktop.
Save sashasklar/882196 to your computer and use it in GitHub Desktop.
var myObject = (function() {
// private stuff
var private = 'foo';
return {
publicFunction: function() {alert(private);},
public: 'bar'
};
})(); // execute this right away
myObject.publicFunction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment