Skip to content

Instantly share code, notes, and snippets.

@tkissing
Created January 10, 2015 00:06
Show Gist options
  • Select an option

  • Save tkissing/6debd663d82c160bf241 to your computer and use it in GitHub Desktop.

Select an option

Save tkissing/6debd663d82c160bf241 to your computer and use it in GitHub Desktop.
function A() {
function privateA() {}
function privateB() {}
function publicA() {
// now this.publicB() here, just publicB() - safes typing and even if someone overrides publicB we still use the implementation from here
// of course that latter might not be desired, in which case you'd write this.publicB() here
return publicB() ? privateA() : privateB();
}
this.publicA = publicA;
function publicB() {}
this.publicB = publicB;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment