Created
June 29, 2014 13:33
-
-
Save vjeux/24bb600d563e6b0e68c6 to your computer and use it in GitHub Desktop.
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 SomeClassClosure = function() { | |
this.method = function() {} | |
} | |
new SomeClassClosure | |
// {method: fnA()} | |
new SomeClassClosure | |
// {method: fnB()} // a new fn is allocated each time | |
var SomeClassPrototype = function() {} | |
SomeClassPrototype.prototype.method = function() {} | |
new SomeClassPrototype | |
// {__proto__: SomeClassPrototype.prototype} | |
new SomeClassPrototype | |
// {__proto__: SomeClassPrototype.prototype} | |
// method is shared between the two instances |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment