Created
March 25, 2010 14:58
-
-
Save rhyolight/343636 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function mixin(from, to) { | |
var property; | |
for (property in from) { | |
if (!to.hasOwnProperty(property)) { | |
to[property] = from[property]; | |
} | |
} | |
return to; | |
} |
This is all relating back to http://rhyolight.posterous.com/javascript-constructor-performance (in case anyone reading was wondering)
Re: apply
You're right, it's more appropriate for the classic prototypal inhertance.
Re: performance. Woohoo, good deal! (Though I'm glad you simplified things a bit for the blog follow-up. I started getting lost in all those permutations.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow, so I tried the idea out:
http://s.dangertree.net/p/constr_perf5.png