Last active
March 1, 2016 18:29
-
-
Save deathbearbrown/0d5a2e238cd5ee9c54be to your computer and use it in GitHub Desktop.
What are the benefits of one of these over the other?
This file contains hidden or 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
// Is there a benefit to one of these | |
Foobar.prototype = {}; | |
Foobar.prototype.constructor = Foobar; | |
function Foobar() {}; | |
Foobar.prototype.baz = function(){}; | |
// over the other? | |
function Foobar() {}; | |
var prototype = (Foobar.prototype = {}); //Base is an object that can be {} | |
prototype.constructor = Foobar; | |
prototype.baz = function(){}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment