Skip to content

Instantly share code, notes, and snippets.

@rhyolight
Created March 25, 2010 14:58
Show Gist options
  • Save rhyolight/343636 to your computer and use it in GitHub Desktop.
Save rhyolight/343636 to your computer and use it in GitHub Desktop.
function mixin(from, to) {
var property;
for (property in from) {
if (!to.hasOwnProperty(property)) {
to[property] = from[property];
}
}
return to;
}
@dshaw
Copy link

dshaw commented Apr 8, 2010

Re: apply

You're right, it's more appropriate for the classic prototypal inhertance.

@dshaw
Copy link

dshaw commented Apr 8, 2010

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