Skip to content

Instantly share code, notes, and snippets.

@mhairston
Created April 22, 2019 13:14
Show Gist options
  • Save mhairston/161d307701ca9ec4c740fc8e014017b3 to your computer and use it in GitHub Desktop.
Save mhairston/161d307701ca9ec4c740fc8e014017b3 to your computer and use it in GitHub Desktop.
Extend JS object
// from https://plainjs.com/javascript/utilities/merge-two-javascript-objects-19/
function extend(obj, src) {
Object.keys(src).forEach(function(key) { obj[key] = src[key]; });
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment