Skip to content

Instantly share code, notes, and snippets.

@dlucidone
Created March 8, 2019 09:15
Show Gist options
  • Save dlucidone/c9e02fc267423f3a4389023249e29daf to your computer and use it in GitHub Desktop.
Save dlucidone/c9e02fc267423f3a4389023249e29daf to your computer and use it in GitHub Desktop.
Deep Clone Object
function cloneObject(obj) {
var clone = {};
for(var i in obj) {
if(typeof(obj[i])=="object" && obj[i] != null)
clone[i] = cloneObject(obj[i]);
else
clone[i] = obj[i];
}
return clone;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment