Created
September 7, 2012 23:45
-
-
Save gjtorikian/3670794 to your computer and use it in GitHub Desktop.
JavaScript Object Extend
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
function extend(o, plus) { | |
var r = {}, | |
i; | |
for (i in o) { | |
if (o.hasOwnProperty(i)) { | |
r[i] = o[i]; | |
} | |
} | |
if (plus) { | |
for (i in plus) { | |
if (plus.hasOwnProperty(i)) { | |
r[i] = plus[i]; | |
} | |
} | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment