Skip to content

Instantly share code, notes, and snippets.

@gjtorikian
Created September 7, 2012 23:45
Show Gist options
  • Save gjtorikian/3670794 to your computer and use it in GitHub Desktop.
Save gjtorikian/3670794 to your computer and use it in GitHub Desktop.
JavaScript Object Extend
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