Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kirantemojo/2cdac035e4d6d77c28c35ace003cfdf2 to your computer and use it in GitHub Desktop.
Save kirantemojo/2cdac035e4d6d77c28c35ace003cfdf2 to your computer and use it in GitHub Desktop.
/**
* Creating multiple constructors @ each instance
* @constrctor
* /
function Foobar(foobar) {
this.foobar = foobar;
}
Foobar.prototype = {
foobar: null
};
Foobar.fromComponents = function(foo, bar) {
var foobar = foo + bar;
// this will make ths constructor to re-instantiate
return new this(foobar);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment