Skip to content

Instantly share code, notes, and snippets.

@dotku
Created April 11, 2019 03:44
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 dotku/1df57a148b5d5b23e8fefcfbbd98214a to your computer and use it in GitHub Desktop.
Save dotku/1df57a148b5d5b23e8fefcfbbd98214a to your computer and use it in GitHub Desktop.
function cloneObject(obj) {
var clone = {};
for(var i in obj) {
if(obj[i] != null && typeof(obj[i])=="object")
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