Skip to content

Instantly share code, notes, and snippets.

@matthewhudson
Created November 1, 2011 19:31
Show Gist options
  • Save matthewhudson/1331649 to your computer and use it in GitHub Desktop.
Save matthewhudson/1331649 to your computer and use it in GitHub Desktop.
Best-practive JavaScript class: "that" is public, "my" is private to the object.
var constructor = function (spec, my) {
var that = {};
var my = my || {};
// This function is private.
my.privateFunction = function() {
return true;
};
// This function is public.
that.publicFunction = function() {
return true;
};
return that;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment