Skip to content

Instantly share code, notes, and snippets.

@richcollins
Created August 21, 2008 00:03
Show Gist options
  • Save richcollins/6467 to your computer and use it in GitHub Desktop.
Save richcollins/6467 to your computer and use it in GitHub Desktop.
Object.prototype.clone = function()
{
var constructor = function(){};
constructor.prototype = this;
return new constructor;
}
var Foo = Object.prototype.clone();
Foo.hello = function(){
console.log("hello");
}
var helloer = Foo.clone();
helloer.hello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment