Created
September 1, 2015 11:02
-
-
Save kindziora/f4c4f6c9f4d399cb15ab to your computer and use it in GitHub Desktop.
function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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