Skip to content

Instantly share code, notes, and snippets.

@plechazunga
Created September 7, 2012 17:37
Show Gist options
  • Select an option

  • Save plechazunga/3668042 to your computer and use it in GitHub Desktop.

Select an option

Save plechazunga/3668042 to your computer and use it in GitHub Desktop.
Prototypes - The beget method
// Thanks Douglas Crockford
if (typeof Object.beget !== 'function') {
Object.beget = function(o) {
var F = function() {};
F.prototype = o;
return new F();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment