Skip to content

Instantly share code, notes, and snippets.

@sergiogarciadev
Created May 18, 2017 18:41
Show Gist options
  • Save sergiogarciadev/7752dbc694055d423ea6c5ca0d1f6c6d to your computer and use it in GitHub Desktop.
Save sergiogarciadev/7752dbc694055d423ea6c5ca0d1f6c6d to your computer and use it in GitHub Desktop.
Mixins in Javascript
function extend() {
var destination = arguments[0];
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var k in source) {
if (source.hasOwnProperty(k)) {
destination[k] = source[k];
}
}
}
return destination;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment