Skip to content

Instantly share code, notes, and snippets.

@JohnArcher
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save JohnArcher/8502356fb3c8aa7779e5 to your computer and use it in GitHub Desktop.

Select an option

Save JohnArcher/8502356fb3c8aa7779e5 to your computer and use it in GitHub Desktop.
JavaScript-Class-Template with public and private members and functions
function MyClass() {
// private member
var that = this;
// public members
this.publicMember = 'Bazinga';
// private functions
var privateFunction = function() {
};
// public functions
this.publicFunction1 = function() {
var privateFunctionResult = privateFunction();
};
this.publicFunction2 = function() {
var publicFunction1Result = that.publicFunction2();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment