Skip to content

Instantly share code, notes, and snippets.

@deathbearbrown
Last active March 1, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deathbearbrown/0d5a2e238cd5ee9c54be to your computer and use it in GitHub Desktop.
Save deathbearbrown/0d5a2e238cd5ee9c54be to your computer and use it in GitHub Desktop.
What are the benefits of one of these over the other?
// 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