Skip to content

Instantly share code, notes, and snippets.

@tatey
Created October 14, 2013 11:06
Show Gist options
  • Save tatey/6974057 to your computer and use it in GitHub Desktop.
Save tatey/6974057 to your computer and use it in GitHub Desktop.
var MyClass = function() {
this.myAttribute = 1;
return this;
};
MyClass.classMethod = function() {
};
MyClass.prototype.instancMethod = function() {
};
// Instantiating a class
var instance = new MyClass();
// Calling an instance method
instance.instanceMethod();
// Calling a class method
MyClass.classMethod();
@tatey
Copy link
Author

tatey commented Oct 14, 2013

(function(global) {
  var MyClass = function() {
    return this;
  };

  global.MyClass = MyClass;
})(this);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment