Skip to content

Instantly share code, notes, and snippets.

@martinec
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinec/7fe3fa8416cd9e7d0f8a to your computer and use it in GitHub Desktop.
Save martinec/7fe3fa8416cd9e7d0f8a to your computer and use it in GitHub Desktop.
Updating javascript object property
function update ( first, second ) {
for (var key in second) {
if (first.hasOwnProperty(key)) {
first[ key ] = second[ key ];
}
}
return first;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment