Skip to content

Instantly share code, notes, and snippets.

@garystorey
Created October 7, 2014 16:44
Show Gist options
  • Select an option

  • Save garystorey/192c6520bb3e567e72b3 to your computer and use it in GitHub Desktop.

Select an option

Save garystorey/192c6520bb3e567e72b3 to your computer and use it in GitHub Desktop.
Extends one JS object from another
function extendDefaults(source, properties) {
var property;
for (property in properties) {
if (properties.hasOwnProperty(property)) {
source[property] = properties[property];
}
}
return source;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment