Skip to content

Instantly share code, notes, and snippets.

@kindziora
Created September 1, 2015 11:02
Show Gist options
  • Save kindziora/f4c4f6c9f4d399cb15ab to your computer and use it in GitHub Desktop.
Save kindziora/f4c4f6c9f4d399cb15ab to your computer and use it in GitHub Desktop.
function
var a = function () {
this.test1 = function() {
alert('a');
};
return this;
};
var b = a.call( new function(){
this.test2 = function() {
alert('b');
};
});
var c = function() {
this.test3 = function() {
alert('c');
};
return this;
}.bind(b)();
var d = function(parent){
this.parent = parent;
this.test4 = function() {
alert('d');
};
this.test5 = parent.test1;
/**
* private
*/
function test6(obj){
return new d(obj);
};
this.factory = test6;
};
var e = new d(c);
console.log(e);
var f = e.factory(e);
console.log(f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment