Skip to content

Instantly share code, notes, and snippets.

@petermichaux
Created March 4, 2012 01:30
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 petermichaux/1969792 to your computer and use it in GitHub Desktop.
Save petermichaux/1969792 to your computer and use it in GitHub Desktop.
A faster Object.create polyfill that reuses F (doesn't support the second argument to Object.create)
if (typeof Object.create !== "function") {
Object.create = (function() {
function F() {}
return function (o) {
F.prototype = o;
return new F();
};
}());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment