Skip to content

Instantly share code, notes, and snippets.

@ClayShentrup
Created July 20, 2012 06:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ClayShentrup/3149174 to your computer and use it in GitHub Desktop.
Save ClayShentrup/3149174 to your computer and use it in GitHub Desktop.
beget question
function beget(parent, child){
// put code here to make test() return true
};
function test(){
function Parent(){
throw 'exception';
};
Parent.prototype = {code: Math.random()};
function Child(){};
beget(Parent, Child);
delete Child.prototype.code;
return new Child().code === Parent.prototype.code &&
Child.prototype !== Parent.prototype;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment