Skip to content

Instantly share code, notes, and snippets.

@vasylpb
Created November 24, 2019 07:44
Show Gist options
  • Save vasylpb/e4a5d579a285c67a86bc2d6a7a7bf35f to your computer and use it in GitHub Desktop.
Save vasylpb/e4a5d579a285c67a86bc2d6a7a7bf35f to your computer and use it in GitHub Desktop.
deep clone
function deepClone(object){
var newObject = {};
for(var key in object){
if(typeof object[key] === 'object' && object[key] !== null ){
newObject[key] = deepClone(object[key]);
}else{
newObject[key] = object[key];
}
}
return newObject;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment