Skip to content

Instantly share code, notes, and snippets.

@aredridel
Created January 8, 2014 02:48
Show Gist options
  • Select an option

  • Save aredridel/8310945 to your computer and use it in GitHub Desktop.

Select an option

Save aredridel/8310945 to your computer and use it in GitHub Desktop.
A method for having a 'private method' in javascript.
module.exports = function Class() {}
Class.prototype.method = function () {
SomethingInternal.call(this)
}
function SomethingInternal() {
console.log("I'm internal, and I'm currently a method of", this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment