Created
July 16, 2018 13:10
-
-
Save jyotiarora2610/388354bd0085e56eed8480f4f298b9e8 to your computer and use it in GitHub Desktop.
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 deepClone(object){ | |
var newObject = {}; | |
for(var key in object){ | |
if(typeof object[key] === 'object'){ | |
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