Created
March 18, 2011 17:02
-
-
Save buzzedword/876430 to your computer and use it in GitHub Desktop.
Recommended alternative to mutable __proto__ from mozilla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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