Skip to content

Instantly share code, notes, and snippets.

Created September 28, 2011 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/1246928 to your computer and use it in GitHub Desktop.
Save anonymous/1246928 to your computer and use it in GitHub Desktop.
Basic Structure For JS
var myApp = myApp || {};
myApp = function () {
var privateProperty = 'This is a private property';
var privateMethod = function () {
console.log('This is a private method.');
};
var obj = {
init: function () {
privateMethod();
this.publicMethod();
},
publicMethod: function () {
console.log('This is a public method.');
}
};
return obj;
}();
$(document).ready(function () {
myApp.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment