Skip to content

Instantly share code, notes, and snippets.

@ptquang86
Created May 28, 2012 07:34
Show Gist options
  • Save ptquang86/2817874 to your computer and use it in GitHub Desktop.
Save ptquang86/2817874 to your computer and use it in GitHub Desktop.
CommonJS modules
function Car() {
this.init.apply(this, arguments);
}
Car.prototype.init = function (make, model) {
this.make = make;
this.model = model;
};
Car.prototype.make = null;
Car.prototype.model = null;
Car.createWithMakeAndModel = function (make, model) {
return new Car(make, model);
};
module.exports = Car;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment