Skip to content

Instantly share code, notes, and snippets.

@buzzedword
Created March 18, 2011 17:02
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 buzzedword/876430 to your computer and use it in GitHub Desktop.
Save buzzedword/876430 to your computer and use it in GitHub Desktop.
Recommended alternative to mutable __proto__ from mozilla
Object.create2 = function(a, b) {
var res = Object.create(a);
for (var x in b) { if (b.hasOwnProperty(x)) res[x] = b[x]; }
return res;
}
var o = Object.create2(foo, { f:0, g:1, ... });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment