Created
March 6, 2016 19:25
-
-
Save TravisMullen/c5e450453d1b4bbda2b7 to your computer and use it in GitHub Desktop.
Extend an object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var extend = function(out) { | |
out = out || {}; | |
for (var i = 1; i < arguments.length; i++) { | |
if (!arguments[i]) | |
continue; | |
for (var key in arguments[i]) { | |
if (arguments[i].hasOwnProperty(key)) | |
out[key] = arguments[i][key]; | |
} | |
} | |
return out; | |
}; | |
extend({}, objA, objB); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment