Skip to content

Instantly share code, notes, and snippets.

@c3ry5
Last active November 4, 2018 11:24
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 c3ry5/6055052 to your computer and use it in GitHub Desktop.
Save c3ry5/6055052 to your computer and use it in GitHub Desktop.
Merging two js objects without jquery
Object.prototype.assign = Object.assign || function(obj1, obj2) {
var obj3 = obj1;
for (var attrname in obj2) {
if (typeof(obj2[attrname]) !== 'function') {
obj3[attrname] = obj2[attrname];
}
}
return obj3;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment